#30378 [Opn]: Random results with ctype_digit

From: Date: Mon, 11 Oct 2004 05:56:33 +0000
Subject: #30378 [Opn]: Random results with ctype_digit
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969364482@lists.php.net to get a copy of this message
ID: 30378 Updated by: derick@php.net Reported By: guth at fiifo dot u-psud dot fr Status: Open -Bug Type: Unknown/Other Function +Bug Type: Documentation problem PHP Version: 5CVS-2004-10-10 (dev) New Comment: This is correct behavior though, as the numbers are automatically converted to strings in PHP, that's why it is called a losely-typed language. Though the manual should mention that if you pass an integer smaller than 256 it will use the ascii value of it to see if it fits in the specified range (digits are in 0x30-0x39). If the number is between -128 (inclusive) and 0 then 256 will be added and the check will be done on that again. Previous Comments: ------------------------------------------------------------------------ [2004-10-10 00:15:45] guth at fiifo dot u-psud dot fr Description: ------------ See the following code : Reproduce code: --------------- echo "<?php var_dump(ctype_digit(1)) ?>" | php echo "<?php var_dump(ctype_digit(1000000000)) ?>" | php Expected result: ---------------- The prototype of this function is bool ctype_digit ( string text), so i expected : bool(false) bool(false) Actual result: -------------- bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30378&edit=1

« previous php.doc (#969364482) next »