mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Clarify the uniqueness and stability of casting resources to string/integer.
It was pointed out on comp.lang.php that the existing wording was unclear on the point of what in the resource->string casting behaviour shouldn't be relied upon (whether it was not guaranteed that the string is unique, or just that the exact format of the string is subject to change). I've also added a paragraph to the integer page noting what a resource->integer cast results in. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332894 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
bd34864223
commit
7c2c57dddc
2 changed files with 13 additions and 5 deletions
|
@ -197,6 +197,12 @@ var_dump(round(25/7)); // float(4)
|
|||
<type>integer</type> with the <function>intval</function> function.
|
||||
</simpara>
|
||||
|
||||
<simpara>
|
||||
If a <type>resource</type> is converted to an <type>integer</type>, then
|
||||
the result will be the unique resource number assigned to the
|
||||
<type>resource</type> by PHP at runtime.
|
||||
</simpara>
|
||||
|
||||
<simpara>
|
||||
See also <link linkend="language.types.type-juggling">Type Juggling</link>.
|
||||
</simpara>
|
||||
|
|
|
@ -960,11 +960,13 @@ bool(false)
|
|||
|
||||
<para>
|
||||
<type>Resource</type>s are always converted to <type>string</type>s with the
|
||||
structure <literal>"Resource id #1"</literal>, where <literal>1</literal> is
|
||||
the unique number assigned to the <type>resource</type> by PHP at runtime. Do
|
||||
not rely upon this structure; it is subject to change. To get a
|
||||
<type>resource</type>'s type, use the
|
||||
<function>get_resource_type</function> function.
|
||||
structure <literal>"Resource id #1"</literal>, where <literal>1</literal>
|
||||
is the resource number assigned to the <type>resource</type> by PHP at
|
||||
runtime. While the exact structure of this string should not be relied on
|
||||
and is subject to change, it will always be unique for a given resource
|
||||
within the lifetime of a script being executed (ie a Web request or CLI
|
||||
process) and won't be reused. To get a <type>resource</type>'s type, use
|
||||
the <function>get_resource_type</function> function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue