kennyt          Sun Jan 11 14:29:13 2004 EDT

  Modified files:              
    /phpdoc/en/chapters tutorial.xml 
  Log:
  stops, wc, example cleaning, more syntax
  
  
Index: phpdoc/en/chapters/tutorial.xml
diff -u phpdoc/en/chapters/tutorial.xml:1.26 phpdoc/en/chapters/tutorial.xml:1.27
--- phpdoc/en/chapters/tutorial.xml:1.26        Tue Jan  6 04:22:50 2004
+++ phpdoc/en/chapters/tutorial.xml     Sun Jan 11 14:29:13 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.26 $ -->
+<!-- $Revision: 1.27 $ -->
  <chapter id="tutorial">
   <title>A simple tutorial</title>
 
@@ -30,7 +30,7 @@
     any extra tools. Think of these PHP-enabled files as simple HTML
     files with a whole new family of magical tags that let you do all
     sorts of things.  Most web hosts offer PHP support, but if your
-    host does not consider reading the <ulink url="&url.php.links;">
+    host does not, consider reading the <ulink url="&url.php.links;">
     PHP Links</ulink> section for resources on finding PHP enabled
     web hosts.
    </para>
@@ -56,7 +56,7 @@
    <title>Your first PHP-enabled page</title>
    <para>
     Create a file named <filename>hello.php</filename> and put it
-    in your web servers root directory (<varname>DOCUMENT_ROOT</varname>) 
+    in your web server's root directory (<varname>DOCUMENT_ROOT</varname>) 
     with the following content:
    </para>
    <para>
@@ -69,17 +69,17 @@
   <title>PHP Test</title>
  </head>
  <body>
- <?php echo "<p>Hello World</p>"; ?>
+ <?php echo '<p>Hello World</p>'; ?>
  </body>
 </html>
 ]]>
      </programlisting>
      <simpara>
-      Use your browser to access the file with your web access URL, ending
+      Use your browser to access the file with your web server's URL, ending
       with the "/hello.php" file reference.  When developing locally this
       url will be something like <literal>http://localhost/hello.php</literal> 
       or <literal>http://127.0.0.1/hello.php</literal> but this depends on the
-      web servers configuration.  Although this is outside the scope of this
+      web server's configuration.  Although this is outside the scope of this
       tutorial, see also the <varname>DocumentRoot</varname> and
       <varname>ServerName</varname> directives in your web server's
       configuration file (for Apache, this is &httpd.conf;).
@@ -113,14 +113,14 @@
     statement.
    </para>
    <para>
-    If you tried this example and it did not output anything, or it prompted 
+    If you tried this example and it did not output anything, it prompted 
     for download, or you see the whole file as text, chances are that the 
     server you are on does not have PHP enabled. Ask your administrator 
     to enable it for you using the
     <link linkend="installation">Installation</link> chapter 
-    of the manual.  If you are developing locally, also read the
+    of the manual. If you are developing locally, also read the
     installation chapter to make sure everything is configured
-    properly.  If problems continue to persist, do not hesitate to use one of
+    properly. If the problems persist, do not hesitate to use one of
     the many <ulink url="&url.php.support;">PHP support</ulink> options.
    </para>
    <para>
@@ -137,7 +137,7 @@
     <para>
      There are many text editors and Integrated Development Environments (IDEs)
      that you can use to create, edit and manage PHP files. A partial list of 
-     these tools is maintained at <ulink url="&url.phpeditorlist;">PHP Editor's
+     these tools is maintained at <ulink url="&url.phpeditorlist;">PHP Editors
      List</ulink>. If you wish to recommend an editor, please visit the above
      page and ask the page maintainer to add the editor to the list.  Having
      an editor with syntax highlighting can be helpful.
@@ -156,14 +156,14 @@
    
    <note>
     <title>A Note on Windows Notepad</title>
-    <para>    
+    <para>
      If you are writing your PHP scripts using Windows Notepad, you will need
      to ensure that your files are saved with the .php extension. (Notepad adds
      a .txt extension to files automatically unless you take one of the
      following steps to prevent it.)  When you save the file and are prompted
      to provide a name for the file, place the filename in quotes 
-     (i.e. "<filename>hello.php</filename>").  Alternately, you can click on the 
-     'Text Documents' drop-down menu in the save dialog box and change the setting 
+     (i.e. "<filename>hello.php</filename>").  Alternatively, you can click on the 
+     'Text Documents' drop-down menu in the 'Save' dialog box and change the setting 
      to "All Files". You can then enter your filename without quotes.
     </para>
   </note>
@@ -189,14 +189,14 @@
     sends as part of the HTTP request. This information is stored in a <link
     linkend="language.variables">variable</link>. Variables always start
     with a dollar-sign in PHP. The variable we are interested in right now 
-    is <varname>$_SERVER["HTTP_USER_AGENT"]</varname>.
+    is <varname>$_SERVER['HTTP_USER_AGENT']</varname>.
    </para>
    <note>
     <para>
      <link linkend="reserved.variables.server">$_SERVER</link> is a 
      special reserved PHP variable that contains all web server information.
      It is known as an autoglobal (or superglobal).  See the related manual page on
-     <link linkend="language.variables.superglobals">autoglobals</link>
+     <link linkend="language.variables.superglobals">superglobals</link>
      for more information.  These special variables were introduced in PHP 
      <ulink url="&url.php.release4.1.0;">4.1.0</ulink>.  Before this time, we used
      the older <varname>$HTTP_*_VARS</varname> arrays instead,
@@ -213,7 +213,7 @@
     <title>Printing a variable (Array element)</title>
     <programlisting role="php">
 <![CDATA[
-<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>
+<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
 ]]>
     </programlisting>
     <para>
@@ -231,8 +231,8 @@
     Arrays can be very useful.
    </para>
    <para>
-    <varname>$_SERVER</varname> is just one variable that is automatically 
-    made available to you by PHP.  A list can be seen in the 
+    <varname>$_SERVER</varname> is just one variable that PHP automatically 
+    makes available to you. A list can be seen in the 
     <link linkend="reserved.variables">Reserved Variables</link> section 
     of the manual or you can get a complete list of them by creating
     a file that looks like this:
@@ -265,8 +265,8 @@
      <programlisting role="php">
 <![CDATA[
 <?php
-if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
-       echo "You are using Internet Explorer<br />";
+if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
+       echo 'You are using Internet Explorer<br />';
 }
 ?>
 ]]>
@@ -295,8 +295,8 @@
     The second concept we introduced was the <function>strpos</function>
     function call. <function>strpos</function> is a function built into
     PHP which searches a string for another string. In this case we are
-    looking for <literal>"MSIE"</literal> (so-called needle) inside
-    <varname>$_SERVER["HTTP_USER_AGENT"]</varname> (so-called haystack).  If
+    looking for <literal>'MSIE'</literal> (so-called needle) inside
+    <varname>$_SERVER['HTTP_USER_AGENT']</varname> (so-called haystack).  If
     the needle is found inside the haystack, the function returns the position
     of the needle relative to the start of the haystack.  Otherwise, it
     returns &false;.  If it does not return &false;, the <link
@@ -322,7 +322,7 @@
      <programlisting role="php">
 <![CDATA[
 <?php
-if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
+if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
 ?>
 <h3>strpos must have returned non-false</h3>
 <center><b>You are using Internet Explorer</b></center>
@@ -386,15 +386,15 @@
     There is nothing special about this form. It is a straight HTML form
     with no special tags of any kind. When the user fills in this form
     and hits the submit button, the <filename>action.php</filename> page
-    is called. In this file you would have something like this:
+    is called. In this file you would write something like this:
    </para>
    <para>
     <example>
      <title>Printing data from our form</title>
      <programlisting role="php">
 <![CDATA[
-Hi <?php echo $_POST["name"]; ?>.
-You are <?php echo $_POST["age"]; ?> years old.
+Hi <?php echo $_POST['name']; ?>.
+You are <?php echo $_POST['age']; ?> years old.
 ]]>
      </programlisting>
      <para>
@@ -402,17 +402,16 @@
      </para>
      <screen role="html">
 <![CDATA[
-Hi Joe.
-You are 22 years old.
+Hi Joe. You are 22 years old.
 ]]>
      </screen>
     </example>
    </para>
    <para>
     It should be obvious what this does. There is nothing more to it.
-    The <varname>$_POST["name"]</varname> and <varname>$_POST["age"]</varname>
+    The <varname>$_POST['name']</varname> and <varname>$_POST['age']</varname>
     variables are automatically set for you by PHP.  Earlier we
-    used the <varname>$_SERVER</varname> autoglobal, now above we just 
+    used the <varname>$_SERVER</varname> autoglobal; above we just 
     introduced the <link linkend="reserved.variables.post">$_POST</link>
     autoglobal which contains all POST data.  Notice how the
     <emphasis>method</emphasis> of our form is POST.  If we used the 
@@ -449,7 +448,7 @@
        <varname>$_FILES</varname>, <varname>$_ENV</varname>,
        <varname>$_REQUEST</varname>, and <varname>$_SESSION</varname>.  The
        older <varname>$HTTP_*_VARS</varname> arrays, such as
-       <varname>$HTTP_POST_VARS</varname>, still exist and have since PHP 3. 
+       <varname>$HTTP_POST_VARS</varname>, still exist as they have since PHP 3. 
        
        &avail.register-long-arrays;
       </simpara>
@@ -463,7 +462,7 @@
        <emphasis>off</emphasis> by default in &php.ini;. The preferred 
        method of accessing these values is via the autoglobal arrays mentioned
        above.  Older scripts, books, and tutorials may rely on this 
-       directive being on.  If on, for example, one could use 
+       directive being on.  If it were on, for example, one could use 
        <varname>$id</varname> from the URL 
        <literal>http://www.example.com/foo.php?id=42</literal>.  Whether on 
        or off, <varname>$_GET['id']</varname> is available.

Reply via email to