regex - Matching a Pattern in PHP -


i trying validate whether or not string contains , starts ba700. have tried using preg_match() function in php have not had luck. code below:

preg_match('/^[0-9]{3}-[0-9]{4}-[0-9]{4}$/', $search))

this not work unfortunately. ideas?

updates code:

$needle = 'ba700'; $haystack = 'ba70012345';  if (stripos($haystack, $needle)) {     echo 'found!'; } 

this not work me either

here how correctly use stripos

if (stripos($haystack, $needle) !== false) {     echo 'found!'; } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -