Re: [PHP] variable type - conversion/checking

[email protected] (Samuel Lopes Grigolato)
Newsgroups php.general
Message-ID <CALC33Gmc1r2KLY=E5O5P_btPJvd=rd4wU+=hf_TMpfU3cZ4LMA@mail.gmail.com>
Something like "if (is_numeric($var)  && $var == floor($var))" will do the
trick. I don't know if there's a better (more elegant) way.


On Thu, Mar 14, 2013 at 3:09 PM, Matijn Woudt <[email protected]> wrote:

> On Thu, Mar 14, 2013 at 7:02 PM, georg <[email protected]> wrote:
>
> > Hi,
> >
> > I have tried to find a way to check if a character string is possible to
> > test whether it is convertible to an intger !
> >
> > any suggestion ?
> >
> > BR georg
>
>
> You could use is_numeric for that, though it also accepts floats.
>
> - Matijn
>
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.