note 96339 added to function.preg-match

From: Date: Mon, 22 Feb 2010 00:53:34 +0000
Subject: note 96339 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-166228@lists.php.net to get a copy of this message
To extract scheme, host, path, ect. simply use <?php $url = 'http://name:pass@'; $url .= 'wild.subdomain.orgy.domain.co.uk:10000'; $url .= '/path/to/file.php?a=1&amp;b=2#anchor'; $url_data = parse_url ( $url ); print_r ( $url_data ); ?> ___ prints out something like: Array ( [scheme] => http [host] => wild.subdomain.orgy.domain.co.uk [port] => 10000 [user] => name [pass] => pass [path] => /path/to/file.php [query] => a=1&b=2 [fragment] => anchor ) In my tests parse_url is up to 15x faster than preg_match(_all)! ---- Server IP: 69.147.83.197 Probable Submitter: 91.89.184.71 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/96339 Del: integrated -- https://master.php.net/note/delete/96339/integrated Del: useless -- https://master.php.net/note/delete/96339/useless Del: bad code -- https://master.php.net/note/delete/96339/bad+code Del: spam -- https://master.php.net/note/delete/96339/spam Del: non-english -- https://master.php.net/note/delete/96339/non-english Del: in docs -- https://master.php.net/note/delete/96339/in+docs Del: other reasons-- https://master.php.net/note/delete/96339 Reject -- https://master.php.net/note/reject/96339 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166228) next »