cvs: phpdoc /en/reference/var/functions is-binary.xml is-buffer.xml is-object.xml is-unicode.xml

From: Date: Mon, 13 Oct 2008 23:35:15 +0000
Subject: cvs: phpdoc /en/reference/var/functions is-binary.xml is-buffer.xml is-object.xml is-unicode.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2228@lists.php.net to get a copy of this message
kalle Mon Oct 13 23:35:15 2008 UTC Modified files: /phpdoc/en/reference/var/functions is-binary.xml is-buffer.xml is-object.xml is-unicode.xml Log: Added examples for: * is_binary * is_buffer * is_object * is_unicode http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/is-binary.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/var/functions/is-binary.xml diff -u phpdoc/en/reference/var/functions/is-binary.xml:1.2 phpdoc/en/reference/var/functions/is-binary.xml:1.3 --- phpdoc/en/reference/var/functions/is-binary.xml:1.2 Wed Jun 20 22:25:34 2007 +++ phpdoc/en/reference/var/functions/is-binary.xml Mon Oct 13 23:35:15 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.is-binary" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>is_binary</refname> @@ -40,6 +40,37 @@ <type>binary</type> string, &false; otherwise. </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>is_binary</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Declare a unicode string +$unicode = 'This is a unicode string'; + +// Declare a binary string using the 'b' prefix +// available as of PHP 5.2.1, but it will only have +// effect as of PHP 6.0.0 +$binary = b'This is a binary string'; + +var_dump(is_binary($unicode), is_binary($binary)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(false) +bool(true) +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/is-buffer.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/var/functions/is-buffer.xml diff -u phpdoc/en/reference/var/functions/is-buffer.xml:1.2 phpdoc/en/reference/var/functions/is-buffer.xml:1.3 --- phpdoc/en/reference/var/functions/is-buffer.xml:1.2 Wed Jun 20 22:25:34 2007 +++ phpdoc/en/reference/var/functions/is-buffer.xml Mon Oct 13 23:35:15 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.is-buffer" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>is_buffer</refname> @@ -42,6 +42,52 @@ &false; otherwise. </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>is_buffer</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Declare some variables with different types +$types = Array( + 'unicode' => 'Unicode string', + 'binary' => b'Binary string', + 'resource' => fopen('php://stdin', 'r'), + 'integer' => 42 + ); + +// Test which types thats a buffer +foreach($types as $type => $value) +{ + if(is_buffer($value)) + { + echo $type . ' is a either a unicode or binary string'; + } + else + { + echo $type . ' is not a buffer value'; + } + + echo PHP_EOL; +} +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +unicode is a either a unicode or binary string +binary is a either a unicode or binary string +resource is not a buffer value +integer is not a buffer value +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/is-object.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/var/functions/is-object.xml diff -u phpdoc/en/reference/var/functions/is-object.xml:1.6 phpdoc/en/reference/var/functions/is-object.xml:1.7 --- phpdoc/en/reference/var/functions/is-object.xml:1.6 Wed Jun 20 22:25:34 2007 +++ phpdoc/en/reference/var/functions/is-object.xml Mon Oct 13 23:35:15 2008 @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xml:id="function.is-object" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>is_object</refname> <refpurpose>Finds whether a variable is an object</refpurpose> </refnamediv> + <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -15,6 +16,7 @@ Finds whether the given variable is an object. </para> </refsect1> + <refsect1 role="parameters"> &reftitle.parameters; <para> @@ -30,6 +32,7 @@ </variablelist> </para> </refsect1> + <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> @@ -37,6 +40,41 @@ &false; otherwise. </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>is_object</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Declare a simple function to return an +// array from our object +function get_students($obj) +{ + if(!is_object($obj)) + { + return(false); + } + + return($obj->students); +} + +// Declare a new class instance and fill up +// some values +$obj = new stdClass; +$obj->students = Array('Kalle', 'Ross', 'Felipe'); + +var_dump(get_students(NULL)); +var_dump(get_students($obj)); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="notes"> &reftitle.notes; <note> @@ -47,6 +85,7 @@ </para> </note> </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> @@ -59,6 +98,7 @@ </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/is-unicode.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/var/functions/is-unicode.xml diff -u phpdoc/en/reference/var/functions/is-unicode.xml:1.2 phpdoc/en/reference/var/functions/is-unicode.xml:1.3 --- phpdoc/en/reference/var/functions/is-unicode.xml:1.2 Wed Jun 20 22:25:34 2007 +++ phpdoc/en/reference/var/functions/is-unicode.xml Mon Oct 13 23:35:15 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.is-unicode" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>is_unicode</refname> @@ -40,6 +40,35 @@ string, &false; otherwise. </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>is_unicode</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Declare a unicode string +$unicode = 'This is a unicode string'; + +// Declare a binary string +$binary = b'This is a binary string'; + +var_dump(is_unicode($unicode), is_bunicode($binary)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(true) +bool(false) +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso;

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