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
Post a Comment