Re: [PHP] intval

2009-05-09 Thread kranthi
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

Re: [PHP] intval

2009-05-09 Thread Robert Cummings
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); > > ?> >

Re: [PHP] intval

2009-05-09 Thread kranthi
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

Re: [PHP] intval

2009-05-09 Thread Robert Cummings
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

Re: [PHP] intval

2009-05-09 Thread kranthi
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

Re: [PHP] intval

2009-05-09 Thread Robert Cummings
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

Re: [PHP] IntVal(float) Returns Different Values (Porting Delphi code to mix a block of data)

2006-03-20 Thread Richard Lynch
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

Re: [PHP] IntVal(float) Returns Different Values (Porting Delphi code to mix a block of data)

2006-03-20 Thread Curt Zirzow
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 = (

Re: [PHP] intval() vs. (int)

2005-09-02 Thread Robert Cummings
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

Re: [PHP] intval() vs. (int)

2005-09-02 Thread Rory Browne
(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

Re: [PHP] intval() vs. (int)

2005-09-02 Thread Philip Hallstrom
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