svn: /phpdoc/en/trunk/language/types/ integer.xml string.xml

From: Date: Wed, 26 Feb 2014 21:23:36 +0000
Subject: svn: /phpdoc/en/trunk/language/types/ integer.xml string.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-12166@lists.php.net to get a copy of this message
aharvey Wed, 26 Feb 2014 21:23:36 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=332894 Log: 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. Changed paths: U phpdoc/en/trunk/language/types/integer.xml U phpdoc/en/trunk/language/types/string.xml Modified: phpdoc/en/trunk/language/types/integer.xml =================================================================== --- phpdoc/en/trunk/language/types/integer.xml 2014-02-26 20:49:22 UTC (rev 332893) +++ phpdoc/en/trunk/language/types/integer.xml 2014-02-26 21:23:36 UTC (rev 332894) @@ -198,6 +198,12 @@ </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> Modified: phpdoc/en/trunk/language/types/string.xml =================================================================== --- phpdoc/en/trunk/language/types/string.xml 2014-02-26 20:49:22 UTC (rev 332893) +++ phpdoc/en/trunk/language/types/string.xml 2014-02-26 21:23:36 UTC (rev 332894) @@ -960,11 +960,13 @@ <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>

« previous php.doc.cvs (#12166) next »