|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-03 16:24 UTC] sedat dot capar at isbank dot net dot tr
Description: ------------ ctype_digit returns 1 (TRUE) for an empty string (I do not mean a blank character) however it must return false (NULL) because empty string means there is no digit. Reproduce code: --------------- $number=""; print ctype_digit($number)."*"; $number=" "; print ctype_digit($number)."*"; $number="1"; print ctype_digit($number); Expected result: ---------------- **1 Actual result: -------------- 1**1 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 23:00:01 2025 UTC |
What are you talking about? # php -r 'var_dump(ctype_digit(""));' bool(false) # php -r 'var_dump(ctype_digit(" "));' bool(false) # php -r 'var_dump(ctype_digit("1"));' bool(true)Hello, you must try your code under windows to understand what I mean here is the results of your codes when I run them under windows C:\php5>php -r var_dump(ctype_digit('23423')); bool(true) C:\php5>php -r var_dump(ctype_digit('')); bool(true) C:\php5>php -r var_dump(ctype_digit('sdf345')); bool(false) As you see in second one it returned true, however it must return false.