Hi,
Does anyone know which string function to use to find out what is in a string at different positions?
For example how would I find out if '00' was in '100000' at the fifth character along. (00 being the last two numbers).
Thanks,
Asa
strrpos() strpos() substr()
It depends on exactly how you need to detect and how the data you're checking will vary.
The above functions should give you a start towards where you need to go. You may also want to try and learn some regular expressions (or PCRE) which can be far more flexible than the built in PHP functions.
This seems to do the trick..
<? $str="00"; if (substr($str, 0, 2)=="00") echo "correct"; else echo"incorrect"; ?>
Thanks