php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #304 In the FAQ, newlines are sometimes missing the \
Submitted: 1998-04-22 20:37 UTC Modified: 1998-07-02 12:37 UTC
From: mark at shelfspace dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 3.0 Release Candidate 4 OS: n/a
Private report: No CVE-ID: None
 [1998-04-22 20:37 UTC] mark at shelfspace dot com
In the FAQ, there are places where the newline command
"\n" is missing the \.

Example: in the Using PHP3 section, the line:
  echo "$var = $value<br>n";
should be:
  echo "$var = $value<br>\n";

and a few paragraphs later:
   echo "headers[$key] = ".$headers[$key]."<br>n";
should be:
   echo "headers[$key] = ".$headers[$key]."<br>\n";

Here's a cut from the FAQ:

Using PHP3

                     I would like to write a generic PHP script that can handle data coming from
                     any form. How do I know which POST method variables are available? 
                          You need to compile PHP with the "--enable-track-vars" configure switch. This
                          creates three associative arrays. $HTTP_GET_VARS, $HTTP_POST_VARS and
                          $HTTP_COOKIE_VARS. So, to write a generic script to handle POST method
                          variables you would need something similar to the following:

                              while (list($var, $value) = each($HTTP_POST_VARS)) {
***ERROR HERE******                   echo "$var = $value<br>n";
                              }

                     When I do the following, the output is printed in the wrong order:

                           function myfunc($argument) {
                             echo $myfunc + 10;
                           }
                           $variable = 10;
                           echo "myfunc($variable) = " . myfunc($variable);
                         

                     What's going on? 
                          To be able to use the results of your function in an expression (such as
                          concatenating it with other strings in the example above), you need to return the
                          value, not echo it. 

                     I need to access information in the request header directly. How can I do
                     this? 
                          The getallheaders() function will do this if you are running PHP as a module. So,
                          the following bit of code will show you all the request headers:

                              $headers = getallheaders();
                                  for(reset($headers); $key = key($headers); next($headers)) {
*******ERROR HERE******              echo "headers[$key] = ".$headers[$key]."<br>n";
                              }

mark

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-02 12:37 UTC] ssb
Fixed, I hope (FAQ.php3 no longer uses stripslashes())


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC