ID: 12876 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Strings related Operating System: Linux Debian 2.2r2 (testing) PHP Version: 4.0.6 New Comment: The above should have read pg_fetch_array not pg_fetch_row. pg_fetch_array without setting result_type to PGSQL_ASSOC returns both field numbers and field names as array indexes. Previous Comments: ------------------------------------------------------------------------ [2001-08-21 10:43:08] [EMAIL PROTECTED] This never used to be the case.. < 4.0.4 So basically don't use == to compare strings? Does PHP convert to numbers when doing 'test' == 'test'? I have this situation <?php // snip $row = pg_fetch_row($result, 0); while( list($field, $value) == each($row) ) { if( $field == 'stateid' ) echo get_state_selector($conn, $value); else echo $value; }?> pg_fetch_row by default returns keys as field names and as array elements. get_state_selector gets outputed for both $row[0] and $row[stateid]. I know I can change pg_fetch_row (which I will) to output field names only, but I haven't run into this in the past. Has something changed? (There was a point pre 4.0.3 where zero (0) didn't equal empty, and now it does.. as in $test = 0; if( empty($test) ) echo "blah"; ) ------------------------------------------------------------------------ [2001-08-21 10:31:29] [EMAIL PROTECTED] You miss something :) Strings will be converted to a number first, which is not possible. The result of this conversion is 0, and (0 == 0) => TRUE. Derick ------------------------------------------------------------------------ [2001-08-21 10:27:54] [EMAIL PROTECTED] When strings are compared to 0, they always return TRUE. <?php $test = 'somestring'; if( $test == 'somestring') echo "Match 1\n"; if( $test == 0 ) echo "Match 2\n"; if( $test == 1 ) echo "Match 3\n"; if( $test != 0 ) echo "Match 4\n"; if( $test != 'somestring' ) echo "Match 5\n"; if( $test != 1 ) echo "Match 6\n"; ?> Expected Output: Match 1 Actual Ouput: Match 1 Match 2 Match 6 Is there something I'm missing? ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12876&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]