From f8c13276826d8117b8913e3fb82462d3e26484c9 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Mon, 13 Oct 2008 23:35:15 +0000 Subject: [PATCH] Added examples for: * is_binary * is_buffer * is_object * is_unicode git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@267304 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/var/functions/is-binary.xml | 33 +++++++++++++++++- reference/var/functions/is-buffer.xml | 48 +++++++++++++++++++++++++- reference/var/functions/is-object.xml | 42 +++++++++++++++++++++- reference/var/functions/is-unicode.xml | 31 ++++++++++++++++- 4 files changed, 150 insertions(+), 4 deletions(-) diff --git a/reference/var/functions/is-binary.xml b/reference/var/functions/is-binary.xml index 3e9a1b36ab..fe110daea2 100644 --- a/reference/var/functions/is-binary.xml +++ b/reference/var/functions/is-binary.xml @@ -1,5 +1,5 @@ - + is_binary @@ -40,6 +40,37 @@ binary string, &false; otherwise. + + + &reftitle.examples; + + + <function>is_binary</function> example + + +]]> + + &example.outputs; + + + + + + &reftitle.seealso; diff --git a/reference/var/functions/is-buffer.xml b/reference/var/functions/is-buffer.xml index 692b4de357..f42040b931 100644 --- a/reference/var/functions/is-buffer.xml +++ b/reference/var/functions/is-buffer.xml @@ -1,5 +1,5 @@ - + is_buffer @@ -42,6 +42,52 @@ &false; otherwise. + + + &reftitle.examples; + + + <function>is_buffer</function> example + + '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; +} +?> +]]> + + &example.outputs; + + + + + + &reftitle.seealso; diff --git a/reference/var/functions/is-object.xml b/reference/var/functions/is-object.xml index aa535381f1..740a2d77f7 100644 --- a/reference/var/functions/is-object.xml +++ b/reference/var/functions/is-object.xml @@ -1,10 +1,11 @@ - + is_object Finds whether a variable is an object + &reftitle.description; @@ -15,6 +16,7 @@ Finds whether the given variable is an object. + &reftitle.parameters; @@ -30,6 +32,7 @@ + &reftitle.returnvalues; @@ -37,6 +40,41 @@ &false; otherwise. + + + &reftitle.examples; + + + <function>is_object</function> example + +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)); +?> +]]> + + + + + &reftitle.notes; @@ -47,6 +85,7 @@ + &reftitle.seealso; @@ -59,6 +98,7 @@ + + is_unicode @@ -40,6 +40,35 @@ string, &false; otherwise. + + + &reftitle.examples; + + + <function>is_unicode</function> example + + +]]> + + &example.outputs; + + + + + + &reftitle.seealso;