clonetrooper9494 Posted September 8, 2009 Share Posted September 8, 2009 I was using StrPos to search a very long string, and when I searched for a string, and a different string using StrPos, they both returned the exact same position, 2977. None of this makes any sence, why is it returning the same position for 2 different strings? My first thought is that the input was just too long for the function to search through, but I am not sure. If you need me to post the source code and a link to the very large file i was inputing, just ask. Link to comment Share on other sites More sharing options...
chibineku Posted September 8, 2009 Share Posted September 8, 2009 If you're using the second strpos within the first one, it won't work because strpos stops as soon as it finds a match, I think. If you're swapping the string to search for, then it's a bit strange. Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted September 8, 2009 Author Share Posted September 8, 2009 I don't understant what you mean by "using the second strpos within the first one", but here is the part of the code I'm referring to: echo strpos($input,$start)."\n<br>\n"; echo strpos($input,$end)."\n<br>\n"; when I put the value of $input in notepad and press CTRL+F, I can find both $start and $end, but this script returns29772977 Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2009 Share Posted September 8, 2009 I don't understant what you mean by "using the second strpos within the first one", but here is the part of the code I'm referring to: echo strpos($input,$start)."\n<br>\n"; echo strpos($input,$end)."\n<br>\n"; when I put the value of $input in notepad and press CTRL+F, I can find both $start and $end, but this script returns29772977 Did you check to see if $start and $end are the same string? Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted September 8, 2009 Author Share Posted September 8, 2009 I assumed that they were different... but I was wrong...*sigh* I hate these simple problems that take you hours to solve... Link to comment Share on other sites More sharing options...
justsomeguy Posted September 8, 2009 Share Posted September 8, 2009 Well why did it take you hours to check if the strings were different? That should be debug step #1 (before posting on a forum, even). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.