svn: /phpdoc/en/trunk/reference/sem/functions/ shm-attach.xml

From: Date: Sat, 23 Oct 2010 06:30:25 +0000
Subject: svn: /phpdoc/en/trunk/reference/sem/functions/ shm-attach.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7300@lists.php.net to get a copy of this message
kalle Sat, 23 Oct 2010 06:30:25 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=304639 Log: Fixed bug #51923 (Documentation does not mention changes to return type of shm_attach) Bug: http://bugs.php.net/51923 (Open) Documentation does not mention changes to return type of shm_attach Changed paths: U phpdoc/en/trunk/reference/sem/functions/shm-attach.xml Modified: phpdoc/en/trunk/reference/sem/functions/shm-attach.xml =================================================================== --- phpdoc/en/trunk/reference/sem/functions/shm-attach.xml 2010-10-23 06:12:15 UTC (rev 304638) +++ phpdoc/en/trunk/reference/sem/functions/shm-attach.xml 2010-10-23 06:30:25 UTC (rev 304639) @@ -71,6 +71,70 @@ </para> </refsect1> + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.3.0</entry> + <entry> + This function now returns a resource instead of an + integer. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + As this function used to return an integer value prior to + PHP 5.3.0. To achieve the same value in a portable value the + return value can be cast to an integer like: + </para> + <para> + <example> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a temporary file and return its path +$tmp = tempnam('/tmp', 'PHP'); + +// Get the file token key +$key = ftok($tmp, 'a'); + +// Attach the SHM resource, notice the cast afterwards +$id = shm_attach($key); + +if($id === false) +{ + die('Unable to create the shared memory segment'); +} + +// Cast to integer, since prior to PHP 5.3.0 the resource id +// is returned which can be exposed when casting a resource +// to an integer +$id = (integer) $id; +?> +]]> + </programlisting> + </example> + </para> + </note> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para>

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