Hacker News new | past | comments | ask | show | jobs | submit login

Is there any way to defend against this one? I know === to turn off type conversion with the equality operator, but what about here?



If condition check type and not try to increment a string...

if (!is_string($notstr)) ++$notstr;

edit:

I think checking for integer is better, if it's just incrementing integer.

I was going to say type hinting but I just realized php's primitive cannot be type hinted.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: