Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for the get_resource_id function #227

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions reference/var/functions/get-resource-id.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.get-resource-id" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>get_resource_id</refname>
<refpurpose>
Returns an integer identifier for the given resource
</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>get_resource_id</methodname>
<methodparam><type>resource</type><parameter>res</parameter></methodparam>
</methodsynopsis>
<para>
This function provides a type-safe way for generating the integer identifier
for a resource.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>res</parameter></term>
<listitem>
<para>
The evaluated resource handle.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The <type>int</type> identifier for the given <parameter>res</parameter>.
</para>
<para>
This function is essentially an <type>int</type> cast of
<parameter>res</parameter> to make it easier to retrieve the resource ID.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>get_resource_id</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$handle = fopen('./storage/logs/lumen.log', 'rt');

echo (int) $handle . "\n\n";

echo get_resource_id($handle);

?>
]]>
</programlisting>
&example.outputs;
<screen role="php">
<![CDATA[
698

698
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>get_resource_type</function></member>
</simplelist>
</para>
</refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
13 changes: 11 additions & 2 deletions reference/var/functions/get-resource-type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
<para>
If the given <parameter>handle</parameter> is a resource, this function
will return a string representing its type. If the type is not identified
by this function, the return value will be the string
by this function, the return value will be the string
<literal>Unknown</literal>.
</para>
<para>
This function will return &null; and generate an error if
This function will return &null; and generate an error if
<parameter>handle</parameter> is not a <type>resource</type>.
</para>
</refsect1>
Expand Down Expand Up @@ -75,6 +75,15 @@ echo get_resource_type($doc->doc) . "\n";
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>get_resource_id</function></member>
</simplelist>
</para>
</refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Expand Down
1 change: 1 addition & 0 deletions reference/var/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<function name='empty' from='PHP 4, PHP 5, PHP 7'/>
<function name='floatval' from='PHP 4 &gt;= 4.2.0, PHP 5, PHP 7'/>
<function name='get_defined_vars' from='PHP 4 &gt;= 4.0.4, PHP 5, PHP 7'/>
<function name='get_resource_id' from='PHP 8'/>
<function name='get_resource_type' from='PHP 4 &gt;= 4.0.2, PHP 5, PHP 7'/>
<function name='gettype' from='PHP 4, PHP 5, PHP 7'/>
<function name='intval' from='PHP 4, PHP 5, PHP 7'/>
Expand Down