...

View Full Version : HELP string search & separate



mcoelho123
06-15-2006, 12:00 PM
Hi all guys,

I have a $recordset that have the value "string(string2)".

How can i separate the string and string2 to $string and $string2?

Thanks

fci
06-15-2006, 01:53 PM
<pre><?php

$str = "string(string2)";

function str_extract($str) {
preg_match("/(\w+)\((\w+)\)/", $str, $matches);
return(array($matches[1] => '', $matches[2] => ''));
}

extract(str_extract($str));
var_dump($string);
var_dump($string2);
/* result
string(0) ""
string(0) ""

*/

?>


why do you want something that would simply initialize variables?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum