ID:               20780
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows 2000
 PHP Version:      4.2.3
 New Comment:

Thanks a lot for your tip. And now I've seen what a silly mistake I'd
made. And I felt deeply sorry for disturbing you with such a silly
fault.

But I wonder if PHP can introduce a Not_a_Number value just like the
NaN in JavaScript. For PHP and JavaScript are both loose-type language,
i.e. scripting language. For some convention, I think, it is unusual to
automatically convert a string (especially a NOT_A_NUMBER string) to an
integer, in which most case is converted to 0 and is not
intuitionistic. And I find many people before have complained about it.
So I'll be glad that you'll consider it.

Thank you again for your serious consideration.


Previous Comments:
------------------------------------------------------------------------

[2002-12-03 01:16:39] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

See

http://ch.php.net/manual/en/language.types.string.php#language.types.string.conversion

------------------------------------------------------------------------

[2002-12-02 23:54:45] [EMAIL PROTECTED]

<?php

$a = 'center';
switch ($a) {
    case 'left':
    case 0: echo 'left';break;
    case 'right':
    case 2: echo 'right';break;
    default:echo 'center';
}

?>

The script should generate 'center',yet generate 'left';what's more,any
string assigned to variable $a will generate the same error. The reason
is the PHP scripting engine cannot distinguish a string with integer 0.
I wonder if the switch statement can only be applied on integers.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20780&edit=1

Reply via email to