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 -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -