philip          Sun Dec 29 23:57:52 2002 EDT

  Modified files:              
    /phpdoc/en/reference/misc/functions get-browser.xml 
  Log:
  Returns an array not object, made docs register_globals = off friendly,
  made example a little more friendly, linked directly to the offsite up-to-date
  browscap.ini instead of faq, other minor changes, and added a <note> to clear 
  up what cookies means. 
  
  
Index: phpdoc/en/reference/misc/functions/get-browser.xml
diff -u phpdoc/en/reference/misc/functions/get-browser.xml:1.4 
phpdoc/en/reference/misc/functions/get-browser.xml:1.5
--- phpdoc/en/reference/misc/functions/get-browser.xml:1.4      Wed Oct  9 05:50:25 
2002
+++ phpdoc/en/reference/misc/functions/get-browser.xml  Sun Dec 29 23:57:52 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
 <!-- splitted from ./en/functions/misc.xml, last change in rev 1.2 -->
   <refentry id="function.get-browser">
    <refnamediv>
@@ -11,21 +11,21 @@
    <refsect1>
     <title>Description</title>
      <methodsynopsis>
-      <type>object</type><methodname>get_browser</methodname>
+      <type>array</type><methodname>get_browser</methodname>
       <methodparam 
choice="opt"><type>string</type><parameter>user_agent</parameter></methodparam>
      </methodsynopsis>
     <simpara>
      <function>get_browser</function> attempts to determine the
      capabilities of the user's browser. This is done by looking up
-     the browser's information in the
-     <filename>browscap.ini</filename> file. By default, the value of
-     $HTTP_USER_AGENT is used; however, you can alter this (i.e., look
-     up another browser's info) by passing the optional
+     the browser's information in the <filename>browscap.ini</filename>
+     file. By default, the value of <varname>HTTP_USER_AGENT</varname> is
+     used; however, you can alter this (i.e., look up another browser's
+     info) by passing the optional 
      <parameter>user_agent</parameter> parameter to
      <function>get_browser</function>.
     </simpara>
     <simpara>
-     The information is returned in an object, which will contain
+     The information is returned in an array, which will contain
      various data elements representing, for instance, the browser's
      major and minor version numbers and ID string; &true;/false values
      for features such as frames, JavaScript, and cookies; and so
@@ -44,15 +44,14 @@
       <programlisting role="php">
 <![CDATA[
 <?php
-function list_array ($array) {
-    while (list ($key, $value) = each ($array)) {
-    $str .= "<b>$key:</b> $value<br />\n";
-    }
-    return $str;
-}
-echo "$HTTP_USER_AGENT<hr />\n";
+echo $_SERVER['HTTP_USER_AGENT'] . "<hr />\n";
+
 $browser = get_browser();
-echo list_array ((array) $browser);
+
+foreach ($browser as $name => $value) {
+    print "<b>$name</b> $value <br />\n";
+}
+
 ?>
 ]]>
       </programlisting>
@@ -66,7 +65,7 @@
 Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr />
 <b>browser_name_pattern:</b> Mozilla/4\.5.*<br />
 <b>parent:</b> Netscape 4.0<br />
-<b>platform:</b> Unknown<br />
+<b>platform:</b> Linux<br />
 <b>majorver:</b> 4<br />
 <b>minorver:</b> 5<br />
 <b>browser:</b> Netscape<br />
@@ -87,16 +86,22 @@
     </programlisting>
     <simpara>
      In order for this to work, your <link
-     linkend="ini.browscap">browscap</link> configuration file
-     setting must point to the correct location of the
-     <filename>browscap.ini</filename> file.
-    </simpara>
-    <simpara>
-     For more information (including locations from which you may
-     obtain a <filename>browscap.ini</filename> file), check the PHP
-     FAQ at <ulink
-     url="&url.php.faq;">&url.php.faq;</ulink>.
-    </simpara>
+     linkend="ini.browscap">browscap</link> configuration setting in
+     &php.ini; must point to the correct location of the
+     <filename>browscap.ini</filename> file on your system.  An up-to-date
+     <filename>browscap.ini</filename> file can be located 
+     <ulink url="&url.browscap.download;">here</ulink>.  By default, this 
+     <link linkend="ini.browscap">browscap</link> directive is commented out.
+    </simpara>
+    <note>
+     <simpara>
+      The <literal>cookies</literal> value simply means that the browser
+      itself is capable of accepting cookies and does not mean the user has 
+      enabled the browser to accept cookies or not.  The only way to test if
+      cookies are accepted is to set one with <function>setcookie</function>,
+      reload, and check for the value.
+     </simpara>
+    </note>
    </refsect1>
   </refentry>
 



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to