On Wed, May 4, 2005 3:51 am, pete M said:
> not a php expert but have filed this bug report re validating
> is_numeric('3e0');
> http://bugs.php.net/bug.php?id=32943
>
> Now tried
>
>function isnumeric($n) {
> if (ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $n)) {
> return true;
> } else {
> From: Jeff Oien <[EMAIL PROTECTED]>
>
> > Does is_numeric include commas decimals and dollar signs?
> >
> > How do I use this to error check form data? I'm having a hard time
> > figuring out what the correct syntax is for that application. Thanks.
> > Jeff
>
> I think what I should have aske
Jeff Oien wrote:
Does is_numeric include commas decimals and dollar signs?
How do I use this to error check form data? I'm having a hard time
figuring out what the correct syntax is for that application. Thanks.
Jeff
I think what I should have asked is how to tell if something is not
numberic.
Je
Well, since is_numeric('.101972E+00') works on it's own, there must be
something else coming with it from the file that makes it fail. Try to
trim() each number before you test it. Maybe that'll help.
---John Holmes...
- Original Message -
From: "fmendezpalma" <[EMAIL PROTECTED]>
To: <[EM
At 03:41 PM 8/28/01 , scott [gts] wrote:
>my understanding is that numeric is a broad term for
>number values (any value with only numbers and a
>decimal point) like 1, 5.6, 332, 0.5532, for example.
>
>integers are a sub-set of numerics, so any integer is
>a numeric value, but any numeric value i
if (($var!=0) && ($var*1!=0) && is_int($var*1))
{
echo "is int";
$var=$var*1;
}
else
{
echo "is not int";
$var=1;
}
Works for me because I need an integer greater than 0. Try it out and let
me know any problems with it.
- seb
-Original Message-
From: Phi
e
> > list ($x, $y) = split("\.", $number);
> >
> > // if there's no decimal value
> > if ( empty($y) ) {
> > return is_int($x);
> > }
> > else {
> > return ( is_int($x) && is_int($y) );
> > }
> >
>
ECTED]]
> Subject: Re: [PHP] is_numeric for php3
>
> Hi Philip,
>
> By definition, any string that does not contain
> alpha-characters is numeric. I mean, '123' is an
> integer, if only because it isn't 'onetwothree', you
> know?
--
PHP Gen
a few months to fully understand them
and get over regexp-heebie-jeebies of my own.
> -Original Message-
> From: daniel james [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 6:42 PM
> To: scott [gts]; php
> Subject: RE: [PHP] is_numeric for php3
>
>
&g
e
> if ( empty($y) ) {
> return is_int($x);
> }
> else {
> return ( is_int($x) && is_int($y) );
> }
>
> }
>
>
> > -Original Message-
> > From: daniel james [mailto:[EMAIL PROTECTED]]
> > Subject: Re: [PHP] is_numeric
split("\.", $number);
// if there's no decimal value
if ( empty($y) ) {
return is_int($x);
}
else {
return ( is_int($x) && is_int($y) );
}
}
> -Original Message-
> From: daniel james [mailto:[EMAIL PROTECTED]]
> Subject: Re: [PHP
Hi Philip,
By definition, any string that does not contain
alpha-characters is numeric. I mean, '123' is an
integer, if only because it isn't 'onetwothree', you
know?
Because if I do this:
$num1 = '123';
$num2 = '456';
$total = $num1 + $num2;
print($total);
the total is going to be 579. You
Hi Daniel,
No, I mean if it's numeric, not neccesarily an integer. As the following
is numeric and not an integer but rather, a string :
$num = '123';
Anyone have an authoritative answer on this? Like, something that would
go in the manual as the official php3 is_numeric check?
Regards,
do you mean, as in,
if !is_integer($var) {
print("$var is not an integer");
}
--- Philip Olson <[EMAIL PROTECTED]> wrote:
> hi friends,
>
> Can someone post here "the" most efficient method to
> validate a variable
> as numeric? I see a ton of hacks/ways in the manual
> user comments under
> i
14 matches
Mail list logo