Skip to content

Doesn't work #1

@bakomon

Description

@bakomon

Example:

function get_domain($url) {
  $str = '/^(?:https?.\/\/)?(?:[^@\/\n]+@)?(?:)?([^:\/?\n]+).*/m';
  preg_match_all($str, $url, $matches, PREG_SET_ORDER, 0);
  foreach ($matches as $key => $value) {
    //var_dump($value);
    return $value[1];
  }
}
echo get_domain("http://www.s.id");

Alternative: jeremykendall/php-domain-parser

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions