Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Take an integer in a php string, such as: $ str ='12
Take an integer in a php string, such as: $ str ='12
& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

$ str = ' 12 | string ';

echo(int)$ str;

//output 12

If you like conventional solutions.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

$ str = ' 12 | string ';

echo preg_replace('/(\d+)。 */',' \\ 1 ',$ str);