Edit report at https://bugs.php.net/bug.php?id=65418&edit=1
ID: 65418 Updated by: yohg...@php.net Reported by: brucewlee at verizon dot net Summary: Neither is_numeric() nor intval() recognize '0b...' strings. Status: Open Type: Bug Package: Strings related -Operating System: Windows 7 +Operating System: Irrelevant -PHP Version: 5.5.1 +PHP Version: 5.4.0 and later Block user comment: N Private report: N New Comment: binary format was introduced from 5.4.0. Previous Comments: ------------------------------------------------------------------------ [2013-08-08 04:36:33] brucewlee at verizon dot net Description: ------------ Neither is_numeric() nor intval() recognize '0b...' strings. Test script: --------------- Code: $as = array("0x10", "16", "020", "0b10000"); foreach($as as $v) { echo "The function is_numeric('" . $v . "') returns "; if (is_numeric($v)) { echo("true"); } else { echo("false"); }; echo ".<br>"; } Output: The function is_numeric('0x10') returns true. The function is_numeric('16') returns true. The function is_numeric('020') returns true. The function is_numeric('0b10000') returns false. Code: $as = array(["0x10", 16], ["16", 10], ["020", 8], ["0b10000", 2]); foreach($as as $v) { echo "The function intval('" . $v[0] . "', " . $v[1] . ") returns " . intval($v[0], $v[1]) . ".<br>"; } Output: The function intval('0x10', 16) returns 16. The function intval('16', 10) returns 16. The function intval('020', 8) returns 16. The function intval('0b10000', 2) returns 0. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65418&edit=1