mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
is_scalar: Removed note, hid TODO comment, added some info.
Regarding TODO, not sure about it, can't think of a better example atm. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@66809 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9a69200810
commit
468daad7ae
1 changed files with 12 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.89 $ -->
|
||||
<!-- $Revision: 1.90 $ -->
|
||||
<reference id="ref.variables">
|
||||
<title>Variable Functions</title>
|
||||
<titleabbrev>Variables</titleabbrev>
|
||||
|
@ -745,20 +745,21 @@ import_request_variables("gP", "rvar_");
|
|||
</para>
|
||||
<para>
|
||||
Scalar variables are those containing an <type>integer</type>,
|
||||
<type>float</type>, <type>string</type> or <type>boolean</type>.
|
||||
For example:
|
||||
<type>float</type>, <type>string</type> or <type>boolean</type>.
|
||||
Types <type>array</type>, <type>object</type> and <type>resource</type>
|
||||
or not scalar.
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<!-- TODO: better example, this one can be quite misleading for unexperienced
|
||||
programmers -->
|
||||
programmers. -->
|
||||
<![CDATA[
|
||||
function show_var($var) {
|
||||
if (is_scalar($var))
|
||||
if (is_scalar($var)) {
|
||||
echo $var;
|
||||
else
|
||||
} else {
|
||||
var_dump($var);
|
||||
}
|
||||
}
|
||||
|
||||
$pi = 3.1416;
|
||||
$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin");
|
||||
|
||||
|
@ -782,15 +783,9 @@ show_var($proteins)
|
|||
<note>
|
||||
<para>
|
||||
<function>is_scalar</function> does not consider <type>resource</type>
|
||||
type values to be scalar values. This behavior is intentional:
|
||||
Resources are abstract datatypes which are currently based on
|
||||
integers. This implementation detail should not be relied upon,
|
||||
as it may change.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Since 4.0.5
|
||||
type values to be scalar as resources are abstract datatypes
|
||||
which are currently based on integers. This implementation detail should
|
||||
not be relied upon, as it may change.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue