I'm trying to split a string using preg_split() ( since split ) is deprected...
I'm trying to split it using '=' sign and to get the GETS variable from a url but I'm getting the error :
"Warning: preg_split() [function.preg-split]: No ending delimiter '=' found in C:"
The code is :
$request_url = $_SERVER;
//parse the page request and get variables
$parsed_url = explode('&',$request_url );
$page_is = array_shift($parsed_url );
$getVars = array();
foreach($parsed_url as $argument)
//split GET vars along '=' symbol to separate variables and values
list($variable,$value) = preg_split("=",$argument);
$getVars[$variable] = $value;
//this is a test and we will be removing it later
print "the page you requested is '$page_is'";
$vars = print_r($getVars,TRUE);
print "The following GET vars were passed to the page:<pre>".$vars."</pre>";
Withing preg_split you should use a regular expression to split. An regular expression string starts with a character that also has to close the string. e.g. "!=!". In your case PHP thought the = was that character.