hholzgra Tue May 1 09:20:52 2001 EDT
Modified files:
/phpdoc/en/functions math.xml pgsql.xml session.xml strings.xml
Log:
floor/ceil return type was not up to the code
Index: phpdoc/en/functions/math.xml
diff -u phpdoc/en/functions/math.xml:1.23 phpdoc/en/functions/math.xml:1.24
--- phpdoc/en/functions/math.xml:1.23 Fri Jan 5 09:35:57 2001
+++ phpdoc/en/functions/math.xml Tue May 1 09:20:51 2001
@@ -138,7 +138,9 @@
</funcsynopsis>
<para>
Returns the absolute value of number. If the argument number is
- float, return type is also float, otherwise it is int.
+ of type <type>float</type>, the return type is also <type>float</type>,
+ otherwise it is <type>int</type> (as <type>float</type> usually has a
+ bigger value range than <type>int</type>).
</para>
</refsect1>
</refentry>
@@ -314,25 +316,16 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>int <function>ceil</function></funcdef>
- <paramdef>float <parameter>number</parameter></paramdef>
+ <funcdef>float <function>ceil</function></funcdef>
+ <paramdef>float <parameter>value</parameter></paramdef>
</funcprototype>
</funcsynopsis>
- <para>
- Returns the next highest integer value from
- <parameter>number</parameter>. Using <function>ceil</function>
- on integers is absolutely a waste of time.
- <informalexample>
- <programlisting role="php">
-$x = ceil(4.25);
-// which would make $x=5
- </programlisting>
- </informalexample>
- </para>
<simpara>
- NOTE: PHP/FI 2's <function>ceil</function> returned a
- float. Use: <literal>$new = (double)ceil($number);</literal> to
- get the old behaviour.
+ Returns the next highest integer value by rounding up
+ <parameter>value</parameter> if necessary.
+ The return value of <function>ceil</function> is still of type
+ <type>float</type> as the value range of <type>float</type> is
+ usually bigger than that of <type>int</type>.
</simpara>
<simpara>
See also <function>floor</function> and
@@ -491,19 +484,16 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>int <function>floor</function></funcdef>
- <paramdef>float <parameter>number</parameter></paramdef>
+ <funcdef>float <function>floor</function></funcdef>
+ <paramdef>float <parameter>value</parameter></paramdef>
</funcprototype>
</funcsynopsis>
- <simpara>
- Returns the next lowest integer value from
- <parameter>number</parameter>. Using <function>floor</function>
- on integers is absolutely a waste of time.
- </simpara>
<simpara>
- NOTE: PHP/FI 2's <function>floor</function> returned a
- float. Use: <literal>$new = (double)floor($number);</literal> to
- get the old behaviour.
+ Returns the next lowest integer value by rounding down
+ <parameter>value</parameter> if neccessary.
+ The return value of <function>ceil</function> is still of type
+ <type>float</type> as the value range of <type>float</type> is
+ usually bigger than that of <type>int</type>.
</simpara>
<simpara>
See also <function>ceil</function> and
@@ -1026,12 +1016,12 @@
</programlisting>
</informalexample>
</para>
- <note>
- <simpara>
- The <parameter>precision</parameter> parameter is only
- available in PHP 4.
- </simpara>
- </note>
+ <note>
+ <simpara>
+ The <parameter>precision</parameter> parameter is only
+ available in PHP 4.
+ </simpara>
+ </note>
<simpara>
See also <function>ceil</function> and
<function>floor</function>.
Index: phpdoc/en/functions/pgsql.xml
diff -u phpdoc/en/functions/pgsql.xml:1.30 phpdoc/en/functions/pgsql.xml:1.31
--- phpdoc/en/functions/pgsql.xml:1.30 Sat Feb 24 17:20:18 2001
+++ phpdoc/en/functions/pgsql.xml Tue May 1 09:20:51 2001
@@ -40,6 +40,7 @@
</row>
<row>
<entry>postmaster -i &</entry>
+<!-- <entry>pg_connect("", "", "", "", "dbname");</entry> -->
<entry>pg_connect("dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
@@ -171,6 +172,27 @@
<refsect1>
<title>Description</title>
<funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>pg_connect</function></funcdef>
+ <paramdef>string <parameter>host</parameter></paramdef>
+ <paramdef>string <parameter>port</parameter></paramdef>
+ <paramdef>string <parameter>dbname</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>int <function>pg_connect</function></funcdef>
+ <paramdef>string <parameter>host</parameter></paramdef>
+ <paramdef>string <parameter>port</parameter></paramdef>
+ <paramdef>string <parameter>options</parameter></paramdef>
+ <paramdef>string <parameter>dbname</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>int <function>pg_connect</function></funcdef>
+ <paramdef>string <parameter>host</parameter></paramdef>
+ <paramdef>string <parameter>port</parameter></paramdef>
+ <paramdef>string <parameter>options</parameter></paramdef>
+ <paramdef>string <parameter>tty</parameter></paramdef>
+ <paramdef>string <parameter>dbname</parameter></paramdef>
+ </funcprototype>
<funcprototype>
<funcdef>int <function>pg_connect</function></funcdef>
<paramdef>string <parameter>conn_string</parameter></paramdef>
Index: phpdoc/en/functions/session.xml
diff -u phpdoc/en/functions/session.xml:1.35 phpdoc/en/functions/session.xml:1.36
--- phpdoc/en/functions/session.xml:1.35 Fri Mar 16 22:38:25 2001
+++ phpdoc/en/functions/session.xml Tue May 1 09:20:51 2001
@@ -136,6 +136,8 @@
<para>
The following example demonstrates how to register a variable, and
how to link correctly to another page using SID.
+ </para>
+ <para>
<example>
<title>Counting the number of hits of a single user</title>
<programlisting role="php">
@@ -147,17 +149,94 @@
Hello visitor, you have seen this page <?php echo $count; ?> times.<p>
<php?
-# the <?=SID?> is necessary to preserve the session id
+# the <?php echo SID;?> is necessary to preserve the session id
# in the case that the user has disabled cookies
?>
-To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>
+To continue, <A HREF="nextpage.php?<?php echo SID;?>">click here</A>
</programlisting>
</example>
</para>
<para>
+ To implement database storage you need PHP code and a user level
+ function <function>session_set_save_handler</function>. You would
+ have to extend the following functions to cover MySQL or another
+ database.
+ </para>
+ <para>
+<<<<<<< session.xml
+ <example>
+ <title>
+ Usage of <function>session_set_save_handler</function>
+ </title>
+ <programlisting role="php">
+<?php
+
+function open ($save_path, $session_name) {
+ echo "open ($save_path, $session_name)\n";
+ return true;
+}
+
+function close() {
+ echo "close\n";
+ return true;
+}
+
+function read ($key) {
+<<<<<<< session.xml
+ echo "read ($key, $val)\n";
+=======
+ echo "read ($key)\n";
+>>>>>>> 1.19
+ return "foo|i:1;";
+}
+
+function write ($key, $val) {
+ echo "write ($key, $val)\n";
+ return true;
+}
+
+function destroy ($key) {
+ return true;
+}
+
+function gc ($maxlifetime) {
+ return true;
+}
+
+session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");
+
+session_start();
+
+$foo++;
+
+?>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ Will produce this results:
+ </para>
+ <para>
+ <programlisting>
+$ ./php save_handler.php
+Content-Type: text/html
+Set-cookie: PHPSESSID=f08b925af0ecb52bdd2de97d95cdbe6b
+
+open (/tmp, PHPSESSID)
+read (f08b925af0ecb52bdd2de97d95cdbe6b)
+write (f08b925af0ecb52bdd2de97d95cdbe6b, foo|i:2;)
+close
+ </programlisting>
+=======
The <literal><?=SID?></literal> is not necessary, if
<literal>--enable-trans-sid</literal> was used to compile PHP.
+>>>>>>> 1.23
+ </para>
+ <para>
+<<<<<<< session.xml
+ The <literal><?php echo SID;?></literal> is not necessary, if
+ <literal>--enable-trans-sid</literal> was used to compile PHP.
</para>
<note>
<para>
@@ -167,11 +246,13 @@
</para>
</note>
<para>
+=======
To implement database storage, or any other storage method, you
will need to use <function>session_set_save_handler</function> to
create a set of user-level storage functions.
</para>
<para>
+>>>>>>> 1.23
The session management system supports a number of configuration
options which you can place in your php.ini file. We will give a
short overview.
Index: phpdoc/en/functions/strings.xml
diff -u phpdoc/en/functions/strings.xml:1.84 phpdoc/en/functions/strings.xml:1.85
--- phpdoc/en/functions/strings.xml:1.84 Tue Apr 24 00:27:01 2001
+++ phpdoc/en/functions/strings.xml Tue May 1 09:20:51 2001
@@ -3426,15 +3426,27 @@
</funcprototype>
</funcsynopsis>
<para>
+<<<<<<< strings.xml
+<<<<<<< strings.xml
+ Capitalizes the first character of each word in
+ <parameter>str</parameter> if that character is alphabetic. A
+ word is defined as any sequence of non-whitespace letters (of the
+ current locale) immediately following a whitespace (space,
+ horizontal or vertical tab, linefeed or carriage return).
+=======
+ Retuns a string with the first character of each word in
+=======
Returns a string with the first character of each word in
+>>>>>>> 1.83
<parameter>str</parameter> capitalized, if that character is
alphabetic.
+>>>>>>> 1.77
<example>
<title><function>ucwords</function> example</title>
<programlisting role="php">
-$text = "mary had a little lamb and she loved it so.";
-$text = ucwords($text); // $text is now: Mary Had A Little
- // Lamb And She Loved It So.
+$text = "mary had a little lamb and she loved it so."; $text =
+ ucwords($text); // $text is now: Mary Had A Little // Lamb
+And
+ She Loved It So.
</programlisting>
</example>
<note>