![]() |
checking string for '
I'm using php.
I have a text box in a form and I want to check if they have typed in a ' charactor in that field. How do i do that in php. Thanks |
PHP Code:
PHP Code:
PHP Code:
|
aaron was nearly right... tho one error.. use this code :)
PHP Code:
P.s. junior members eh ;) :p |
Hey, what was my mistake? the !== instead of !=?
Well check THIS out, mista: http://www.aaron-wright.com/grr.php :p If I'm still wrong, please clarify. lol |
i'd have to say that aarons right !== is not correct AFAIK, unless PHP has been changed
|
Jee may be right actually, but only if you're using the latest version of PHP :) I heard there were some changes being made and that we'll all have to get used to them, but then again I could be terribly misinformed and maybe there isn't even a new version of PHP :eek:
I need to sit down. |
or just
PHP Code:
|
...but being exact, the return value of strstr() isn't a boolean true either - it's only casted to true in the if-statement.
Apparently Jeewhizz confused strstr() with strpos(), because with strpos() you have to be wary of a returned 0 which gets casted to false, that's why you should use !== instead of !=. http://www.php.net/manual/en/function.strpos.php |
*reads post and laughs to self*
|
| All times are GMT +1. The time now is 12:06 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.