Re: [PHP] variable type - conversion/checking

[email protected] (Andrew Ballard)
Newsgroups php.general
Message-ID <CAC1b6Rs8D-DMRs1fzGW9hWFWJGoSnyNkDizPjSvhzi4A_Pvz6A@mail.gmail.com>
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.)

Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.