|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-07-02 12:37 UTC] ssb
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 00:00:02 2025 UTC |
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