Re: [PHP] variable type - conversion/checking
[email protected] (Sebastian Krebs)
| Newsgroups | php.general |
|---|---|
| Message-ID | <CALtuQzA4vUvv7uuQCbUJjffPvCzvRFN6AA__nbrgLXAWMZe0Sw@mail.gmail.com> |
2013/3/16 Andrew Ballard <[email protected]> > I suppose one could try something like this: > > if (is_string($val) && $val === (string)(int)$val) .... > > If $val is an integer masquerading as a string, it should be identical to > the original string when cast back to a string, shouldn't it? (I can't try > it right now.) > It is semantically equivalent to $val == (int) $val and as far as I remember (I didn't read everything completely) this were mentioned. I didn't read, whether or not, it was accepted as solution ;) > > Andrew > -- github.com/KingCrunch