List Info

Thread: note 68522 added to function.is-scalar




note 68522 added to function.is-scalar
user name
2006-07-31 15:59:07
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 -- h
ttp://www.php.net/manual/en/function.is-scalar.php
Edit        -- https://master
.php.net/note/edit/68522
Del: integrated  -- h
ttps://master.php.net/note/delete/68522/integrated
Del: useless     -- http
s://master.php.net/note/delete/68522/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/68522/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/68522
Reject      -- https://mast
er.php.net/note/reject/68522
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )