Saturday, 31 August 2013

how to extract data from preg_replace

how to extract data from preg_replace

I wan to be able to get data from a preg_replace function or a str_replace
function. For example i want to convert any string beginning with @. But i
want to extract that string that begins with @ and put it in my database!
So how can i just extract that specific word that begins with @?
Here is my code:
$string = "@james is awespome";
$convert = preg_replace('@','@$1','$string');
mysql_query( insert stuff);i want to be able to insert @james or james in
the database

No comments:

Post a Comment