php - How to check if any number exists in a word -
php - How to check if any number exists in a word -
for example, if word $item = '3.5floppy'
or $item = '3floppy'
or $item = '4520floppy'
i want check whether number exist in word or not?
try preg_match
simple, there digit or not?
if(preg_match('/(\d)/', $item)) { echo "number found!"; }
\d
mean any digit
regex documentation : http://php.net/manual/en/function.preg-match.php
php
Comments
Post a Comment