php-developer-list | 2001122
Date: 12/19/01
- Next message: derick <email protected>: "[PHP-DEV] Bug #14605 Updated: compare string with integer 0 returns t"
- Previous message: adrian <email protected>: "[PHP-DEV] Bug #14605: compare string with integer 0 returns true"
- In reply to: adrian <email protected>: "[PHP-DEV] Bug #14605: compare string with integer 0 returns true"
- Next in thread: derick <email protected>: "[PHP-DEV] Bug #14605 Updated: compare string with integer 0 returns t"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 14605
Updated by: jan
Reported By: adrian <email protected>
Old Summary: compare string with integer 0 returns true
Old Status: Open
Status: Bogus
Bug Type: Scripting Engine problem
Old Operating System: Linux
Operating System: Windows NT 4 sp 6a
PHP Version: 4.1.0
New Comment:
this i due to the autoconversation of variables in PHP. Your string is converted into an integer during the comparison.The integer is 0, since no fitting value can be found.
So 0 equals 0.
Previous Comments:
------------------------------------------------------------------------
[2001-12-19 11:11:09] adrian <email protected>
<?php
$i = 0;
$s = 'the string';
if($i == $s) {
echo "'$s' == $i";
} else {
echo "'$s' != $i";
}
?>
// This outputs 'the string' == 0
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14605&edit=1
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: derick <email protected>: "[PHP-DEV] Bug #14605 Updated: compare string with integer 0 returns t"
- Previous message: adrian <email protected>: "[PHP-DEV] Bug #14605: compare string with integer 0 returns true"
- In reply to: adrian <email protected>: "[PHP-DEV] Bug #14605: compare string with integer 0 returns true"
- Next in thread: derick <email protected>: "[PHP-DEV] Bug #14605 Updated: compare string with integer 0 returns t"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

