if that is the case & should appear before all the other variables as well
and.
is giving me
array(5) { [0]=> int(1) [1]=> int(100) [2]=> float(100.1) [3]=>
float(100.123) [4]=> string(1) "a" }
ny idea y this difference arises?
--
PHP General Mailing List (http://www.php.net/)
To un
On Sat, 2009-05-09 at 21:23 +0530, kranthi wrote:
> k i ended up with this code
>
>
> $_POST = array( '1', '100', '100.1', '100.123', 'a');
>
> foreach( $_POST as &$value )
> {
> if(is_numeric($value)) {
> $value = $value + 0;
> }
> }
> var_dump($_POST);
>
> ?>
>
k i ended up with this code
its giving me
array(5) { [0]=> int(1) [1]=> int(100) [2]=> float(100.1) [3]=>
float(100.123) [4]=> &string(1) "a" }
what does &string mean ??
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Sat, 2009-05-09 at 20:02 +0530, kranthi wrote:
> thanks for the reply... just happened to see http://php.net/ternary
> which explains the above result
>
> i want to explicitly type cast all the numbers passed via post (by
> default they are strings)
> is_numeric() is a option, but it will not b
thanks for the reply... just happened to see http://php.net/ternary
which explains the above result
i want to explicitly type cast all the numbers passed via post (by
default they are strings)
is_numeric() is a option, but it will not be possible to differentiate
between int and float.
$_POST['mo
On Sat, 2009-05-09 at 18:22 +0530, kranthi wrote:
> var_dump($_POST['month'], intval($_POST['month']), $_POST['month'] ==
> ((int)($_POST['month']));
> var_dump($_POST['month'], intval($_POST['month']), $_POST['month'] ==
> (intval($_POST['month'])));
After I fixed your syntax error this worked fi
Hi,
var_dump($_POST['month'], intval($_POST['month']), $_POST['month'] ==
((int)($_POST['month']));
var_dump($_POST['month'], intval($_POST['month']), $_POST['month'] ==
(intval($_POST['month'])));
is giving me
string(3) "Jan" int(0) bool(true)
but i m expecting
string(3) "Jan" int(0) bool(false)
You probably want to use BC_MATH or that new-fangled thing like it if
you want to deal in INT larger than 32 bit.
Or you could buy 64-bit hardware.
On Mon, March 20, 2006 9:13 am, Bruce wrote:
> I am having trouble porting some code originally written in Borland
> Delphi
> to PHP. The Delphi code
On Mon, Mar 20, 2006 at 10:13:21AM -0500, Bruce wrote:
> I am having trouble porting some code originally written in Borland Delphi
> to PHP. The Delphi code expects certain behavior on integer overflows that I
> can only duplicate on some PHP systems. For example:
>
> $BB = -2181087916;
> $AA = (
I am having trouble porting some code originally written in Borland Delphi
to PHP. The Delphi code expects certain behavior on integer overflows that I
can only duplicate on some PHP systems. For example:
$BB = -2181087916;
$AA = (int)$BB;
$AA = intval($BB);
On some systems, $AA will be (int)-214
On Fri, 2005-09-02 at 14:47, Rory Browne wrote:
> (int) seems to be faster, but not by an awful lot. Personally however
> if its a case of typing five characters (int) and saving a little exec
> time, or typing 8 and losing a little, then I'd perfer to go with the
> five an save the exec time.
(in
(int) seems to be faster, but not by an awful lot. Personally however
if its a case of typing five characters (int) and saving a little exec
time, or typing 8 and losing a little, then I'd perfer to go with the
five an save the exec time.
I think I remember hearing about some other consequence wit
On checking form fields that they are of type int, what is best to use:
intval() or type casting (int)?
In terms of speed, would (int) not be better, because we save a function
call (especially on very large sql statements)?
Time it.
On an 800mhz box doing absolutely nothing else (it's just sit
Hi,
On checking form fields that they are of type int, what is best to use:
intval() or type casting (int)?
In terms of speed, would (int) not be better, because we save a function
call (especially on very large sql statements)?
Thanks.
Thomasx`
SPIRAL EYE STUDIOS
P.O. Box 37907, Faerie Glen
14 matches
Mail list logo