how can I use preg_match to extract secret_password from this string? s:6:"secret_password"
A:
If you have a colon-delimited string, it might be better to use explode(':', $string)
but here is the answer using preg_match
$subject = 's:6:"secret_password"';
$pattern = '/\"[^"]+\"/';
preg_match($pattern, $subject, $matches);
print_r($matches[0]);
MikeD
2010-07-14 22:07:05
yes, explodes look simpler
big ralph
2010-07-14 22:20:01