cvs: phpdoc /en/reference/info/functions assert-options.xml assert.xml get-current-user.xml ini-restore.xml sys-get-temp-dir.xml
/en/reference/strings/functions sha1-file.xml

From: Date: Mon, 20 Oct 2008 10:30:08 +0000
Subject: cvs: phpdoc /en/reference/info/functions assert-options.xml assert.xml get-current-user.xml ini-restore.xml sys-get-temp-dir.xml
/en/reference/strings/functions sha1-file.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2271@lists.php.net to get a copy of this message
kalle Mon Oct 20 10:30:08 2008 UTC Modified files: /phpdoc/en/reference/info/functions assert-options.xml assert.xml get-current-user.xml ini-restore.xml sys-get-temp-dir.xml /phpdoc/en/reference/strings/functions sha1-file.xml Log: * Added new examples for * assert_options * get_current_user * ini_restore * sys_get_temp_dir * sha1_file

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/info/functions/assert-options.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/info/functions/assert-options.xml diff -u phpdoc/en/reference/info/functions/assert-options.xml:1.6 phpdoc/en/reference/info/functions/assert-options.xml:1.7 --- phpdoc/en/reference/info/functions/assert-options.xml:1.6 Wed Jun 20 22:24:47 2007 +++ phpdoc/en/reference/info/functions/assert-options.xml Mon Oct 20 10:30:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xml:id="function.assert-options" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>assert_options</refname> @@ -97,6 +97,55 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>assert_options</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// This is our function to handle +// assert failures +function assert_failure() +{ + echo 'Assert failed'; +} + +// This is our test function +function test_assert($parameter) +{ + assert(is_bool($parameter)); +} + +// Set our assert options +assert_options(ASSERT_ACTIVE, true); +assert_options(ASSERT_BAIL, true); +assert_options(ASSERT_WARNING, false); +assert_options(ASSERT_CALLBACK, 'assert_failure'); + +// Make an assert that would fail +test_assert(1); + +// This is never reached due to ASSERT_BAIL +// being true +echo 'Never reached'; +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>assert</function></member> + </simplelist> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/info/functions/assert.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/info/functions/assert.xml diff -u phpdoc/en/reference/info/functions/assert.xml:1.11 phpdoc/en/reference/info/functions/assert.xml:1.12 --- phpdoc/en/reference/info/functions/assert.xml:1.11 Wed Jun 20 22:24:47 2007 +++ phpdoc/en/reference/info/functions/assert.xml Mon Oct 20 10:30:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <refentry xml:id="function.assert" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>assert</refname> @@ -128,6 +128,15 @@ </para> </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>assert_options</function></member> + </simplelist> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/info/functions/get-current-user.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/info/functions/get-current-user.xml diff -u phpdoc/en/reference/info/functions/get-current-user.xml:1.7 phpdoc/en/reference/info/functions/get-current-user.xml:1.8 --- phpdoc/en/reference/info/functions/get-current-user.xml:1.7 Wed Jun 20 22:24:47 2007 +++ phpdoc/en/reference/info/functions/get-current-user.xml Mon Oct 20 10:30:08 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.get-current-user" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>get_current_user</refname> @@ -24,6 +24,28 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>get_current_user</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Current script owner: ' . get_current_user(); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Current script owner: SYSTEM +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/info/functions/ini-restore.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/info/functions/ini-restore.xml diff -u phpdoc/en/reference/info/functions/ini-restore.xml:1.10 phpdoc/en/reference/info/functions/ini-restore.xml:1.11 --- phpdoc/en/reference/info/functions/ini-restore.xml:1.10 Wed Jun 20 22:24:47 2007 +++ phpdoc/en/reference/info/functions/ini-restore.xml Mon Oct 20 10:30:08 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <refentry xml:id="function.ini-restore" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>ini_restore</refname> @@ -40,6 +40,38 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>ini_restore</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$setting = 'y2k_compliance'; + +echo 'Current value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL; + +ini_set($setting, ini_get($setting) ? 0 : 1); +echo 'New value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL; + +ini_restore($setting); +echo 'Original value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL; +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Current value for 'y2k_compliance': 1 +New value for 'y2k_compliance': 0 +Original value for 'y2k_compliance': 1 +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/info/functions/sys-get-temp-dir.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/info/functions/sys-get-temp-dir.xml diff -u phpdoc/en/reference/info/functions/sys-get-temp-dir.xml:1.4 phpdoc/en/reference/info/functions/sys-get-temp-dir.xml:1.5 --- phpdoc/en/reference/info/functions/sys-get-temp-dir.xml:1.4 Wed Jun 20 22:24:48 2007 +++ phpdoc/en/reference/info/functions/sys-get-temp-dir.xml Mon Oct 20 10:30:08 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xml:id="function.sys-get-temp-dir" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>sys_get_temp_dir</refname> @@ -25,6 +25,32 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>sys_get_temp_dir</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a temporary file in the temporary +// files directory using sys_get_temp_dir() +$temp_file = tempnam(sys_get_temp_dir(), 'Tux'); + +echo $temp_file; +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +C:\Windows\Temp\TuxA318.tmp +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/sha1-file.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/strings/functions/sha1-file.xml diff -u phpdoc/en/reference/strings/functions/sha1-file.xml:1.6 phpdoc/en/reference/strings/functions/sha1-file.xml:1.7 --- phpdoc/en/reference/strings/functions/sha1-file.xml:1.6 Wed Jun 20 22:25:29 2007 +++ phpdoc/en/reference/strings/functions/sha1-file.xml Mon Oct 20 10:30:08 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.sha1-file"> <refnamediv> <refname>sha1_file</refname> @@ -51,6 +51,29 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>sha1_file</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +foreach(glob('/home/Kalle/myproject/*.php') as $ent) +{ + if(is_dir($ent)) + { + continue; + } + + echo $ent . ' (SHA1: ' . sha1_file($ent) . ')', PHP_EOL; +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para>
« previous php.doc.cvs (#2271) next »