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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -