mickeymouse Posted June 9 Share Posted June 9 (edited) Can someone tell me what I'm doing wrong? I believe it's correct code but it doesn't work. I get FOUND no matter what I have in $newnum. $mynums="01-05-15-32-64-81-99"; $newnum="64"; $numpos=strpos($mynums,$newnum); if($numpos<>FALSE) {print("FOUND");} else{print("NOT FOUND");} Thank you Edited June 9 by mickeymouse Link to comment Share on other sites More sharing options...
Ingolme Posted June 9 Share Posted June 9 I just tested your code and it seemed to be working properly. With $newnum="20" it prints "NOT FOUND". Which values of $newnum did you test with? I would check the value of $numpos with the var_dump() function to see what its value is. That will tell you where in the string it found the number. var_dump($numpos); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now