pollita Sat Nov 30 01:47:29 2002 EDT
Modified files:
/phpdoc/en/reference/info/functions ini-get.xml
Log:
Documentation Bug #17389
Updated with examples on using ini_get() with boolean values and memory size values.
Index: phpdoc/en/reference/info/functions/ini-get.xml
diff -u phpdoc/en/reference/info/functions/ini-get.xml:1.2
phpdoc/en/reference/info/functions/ini-get.xml:1.3
--- phpdoc/en/reference/info/functions/ini-get.xml:1.2 Wed Apr 17 02:39:28 2002
+++ phpdoc/en/reference/info/functions/ini-get.xml Sat Nov 30 01:47:29 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/info.xml, last change in rev 1.64 -->
<refentry id="function.ini-get">
<refnamediv>
@@ -13,9 +13,56 @@
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
</methodsynopsis>
<para>
- Returns the value of the configuration option on success, an
- empty string on failure.
+ Returns the value of the configuration option on success. Failure, such
+ as querying for a non-existant value, will return an empty string.
</para>
+ <note>
+ <title>When querying boolean values</title>
+ <para>
+ A boolean ini value of <literal>off</literal> will be returned as an
+ empty string while a boolean ini value of <literal>on</literal> will
+ be returned as "1".
+ </para>
+ </note>
+ <note>
+ <title>When querying memory size values</title>
+ <para>
+ Many ini memory size values, such as <literal>upload_max_filesize</literal>
+ are stored in the .ini file in shorthand notation. <function>ini_get</function>
+ will return the exact string stored in the php.ini file,
+<emphasis>NOT</emphasis>
+ its integer equivalent. Attempting normal arithmetic functions on these values
+ will not have otherwise expected results.
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+/*
+Our php.ini contains the following settings:
+
+display_errors = On
+register_globals = Off
+post_max_size = 8M
+*/
+
+print 'display_errors = ' . ini_get('display_errors') . "\n";
+print 'register_globals = ' . ini_get('register_globals') . "\n";
+print 'post_max_size = ' . ini_get('post_max_size') . "\n";
+print 'post_max_size+1 = ' . (ini_get('post_max_size')+1) . "\n";
+
+/*
+This script will produce:
+
+display_errors = 1
+register_globals =
+post_max_size = 8M
+post_max_size+1 = 9
+*/
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ </note>
<para>
See also <function>get_cfg_var</function>,
<function>ini_get_all</function>,
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php