RE: [PHP] string vs number

2008-02-06 Thread Ford, Mike
On 05 February 2008 21:37, Jochem Maas advised: the same is not exactly true for floats - although you can use them as array keys you'll notice in the output of code below that they are stripped of their decimal part (essentially a floor() seems to be performed on the float value. I have no

Re: [PHP] string vs number

2008-02-06 Thread Jochem Maas
Ford, Mike schreef: On 05 February 2008 21:37, Jochem Maas advised: the same is not exactly true for floats - although you can use them as array keys you'll notice in the output of code below that they are stripped of their decimal part (essentially a floor() seems to be performed on the float

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54']. is this possible? how do i force $rowA[0] to be a string

Re: [PHP] string vs number

2008-02-05 Thread Eric Butera
On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54'].

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:43 PM, Eric Butera [EMAIL PROTECTED] wrote: I was thinking about saying that, but php is loosely typed, so 54 == '54'. i only mentioned the type cast because it was asked about; actually, there are rare times in php when type casts are called for, such as pulling a value from

Re: [PHP] string vs number

2008-02-05 Thread Casey
On Feb 5, 2008, at 10:43 AM, Eric Butera [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:50 PM, Casey [EMAIL PROTECTED] wrote: I believe this is the difference with arrays: $a = array(2 = foo); Array(0 = null, 1 = null, 2 = foo) $a = array(2 = foo); Array(2 = foo) i think the implicit type casting applies there as well: php $meh = array(2=4); php echo

[PHP] string vs number

2008-02-05 Thread Hiep Nguyen
hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54']. is this possible? how do i force $rowA[0] to be a string ('54')? thanks t. hiep -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] string vs number

2008-02-05 Thread Eric Butera
On Feb 5, 2008 1:48 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:43 PM, Eric Butera [EMAIL PROTECTED] wrote: I was thinking about saying that, but php is loosely typed, so 54 == '54'. i only mentioned the type cast because it was asked about; actually, there are rare times

Re: [PHP] string vs number

2008-02-05 Thread Daniel Brown
On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54']. is this possible? how do i force $rowA[0] to be a string ('54')?

Re: [PHP] string vs number

2008-02-05 Thread Jochem Maas
Casey schreef: On Feb 5, 2008, at 10:43 AM, Eric Butera [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ?