parsing - PHP Get a part from $string -


could pls me parse string?

the string is:

$str = 'http://test.al/admin/?plugin=pages&act=delete&file=test-page';

it's dynamic , contain more &-symbols.

i want part starting "&..." result should :

http://boot.al/admin/?plugin=pages 

need go after deleting file, clear additional $_get params.

thank in advance!

use strtok():

<?php $str = 'http://test.al/admin/?plugin=pages&act=delete&file=test-page'; $result = strtok($str, '&');  var_dump($result); // outputs "http://test.al/admin/?plugin=pages" 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -