taking the value contained in the brackets using php -


For example string my name is xyz (25) I want to get 25 in a variable through php .. < /p>

Use preg_match to do this:

  $ string = "Xyz (25)"; Preg_match ("/.* \ ((\ d *) \) /", $ string, $ matches); Print_r (matches $);  

will come back

 array ([0] => xyz (25) [1] => 25) 

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -