Reputation: 3702
I have this in $array[0]:
attack-responses.rules?rev=1.35&content-type=text/vnd.viewcvs-markup
I want to have this in $array[0]
attack-responses.rules
I mean when it will see '?' it must cut it.
Is there any PHP function?
Upvotes: 0
Views: 67
Reputation: 131931
$array[0] = parse_url($array[0], PHP_URL_PATH);
list($array[0]) = explode('?', $array[0], 2);
$array[0] = substr($array[0], 0, strpos($array[0], '?'))
Upvotes: 4
Reputation: 86406
look there at the documentation of parse_url
$str="attack-responses.rules?rev=1.35&content-type=text/vnd.viewcvs-markup";
$url=parse_url($str));
$array[0]=$url['path'];
Upvotes: 0