note 68522 added to function.is-scalar

From: Date: Mon, 31 Jul 2006 15:59:07 +0000
Subject: note 68522 added to function.is-scalar
Groups: php.notes 
Request: Send a blank email to php-notes+get-115377@lists.php.net to get a copy of this message
Another warning in response to the previous note: > just a warning as it appears that an empty value is not a scalar. That statement is wrong--or, at least, has been fixed with a later revision than the one tested. The following code generated the following output on PHP 4.3.9. CODE: <?php echo('is_scalar() test:'.EOL); echo("NULL: " . print_R(is_scalar(NULL), true) . EOL); echo("false: " . print_R(is_scalar(false), true) . EOL); echo("(empty): " . print_R(is_scalar(''), true) . EOL); echo("0: " . print_R(is_scalar(0), true) . EOL); echo("'0': " . print_R(is_scalar('0'), true) . EOL); ?> OUTPUT: is_scalar() test: NULL: false: 1 (empty): 1 0: 1 '0': 1 THUS: * NULL is NOT a scalar * false, (empty string), 0, and "0" ARE scalars ---- Server IP: 64.71.164.2 Probable Submitter: 163.181.251.10 (proxied: 1.1 SAUSISA02) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.is-scalar.php Edit -- https://master.php.net/note/edit/68522 Del: integrated -- https://master.php.net/note/delete/68522/integrated Del: useless -- https://master.php.net/note/delete/68522/useless Del: bad code -- https://master.php.net/note/delete/68522/bad+code Del: spam -- https://master.php.net/note/delete/68522/spam Del: non-english -- https://master.php.net/note/delete/68522/non-english Del: in docs -- https://master.php.net/note/delete/68522/in+docs Del: other reasons-- https://master.php.net/note/delete/68522 Reject -- https://master.php.net/note/reject/68522 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115377) next »