My PHP Info

What is PHP?

    PHP: Hypertext Preprocessor is the current definition of the acronym PHP. The original definition was Personal Home Page Tools. PHP was created by Rasmus Lerdorf in 1994. It started as a collection of Unix-specific HTTP server modules, or tools, designed to assist in the maintenance of a small Web site. It is a language that has evolved considerably since its inception.

    PHP is a server-side scripting language whose primary purpose is to generate HTML content. When your browser requests a PHP page from a PHP-enabled server, the server interprets the PHP code and sends the resulting HTML to the requesting browser. (The browser receives only HTML, not PHP code.) PHP is designed to run on the server, behind the scenes. The PHP code is stripped from the document before it is sent to the user.

    The way PHP works in a Web document, is by treating the document it is embedded in as an output file. It inserts its output at the location in the code where the script is placed. In other words, the output from the script replaces the script before the document is sent on to the user.

    The statements used to write content back to the document in PHP are as follows:

    * echo
    * print()
    * printf()
    * sprintf()
    * print_r()
    * var_dump()
Examples of these in use and a good explanation is found at: Writing Content

JavaScript & PHP:

    JavaScript runs on the client's computer (in their browser). PHP runs server-side and therefore has no access to JavaScript variables... and visa-versa.

Globals

    In addition to the table below I found this explanation of the POST and GET vars that makes them a lot more understandable ... at least to me. POST and GET are the two methods that are available to pass data from a FORM to a PHP page. The GET method sends the data by appending it to the URL of the page. The POST method sends the data and the URL separately. The GET method is faster, but if you are going to send more than 2000 characters, use the POST method. (PHP: Visual Bleprint)

    From Peter L. Kantor's WebPages at the Hudson Valley Community College.

Old Form New Form Description
-- $GLOBALS[] The complete list of all global variables, including user defined variables at the global level.
$HTTP_GET_VARS[] $_GET[] All variables received as part of a query string in the requesting URL, or HTML form data transmitted using the GET method.
$HTTP_POST_VARS[] $_POST[] All variables recieved as an inline posted data set, normally through using the POST method in an HTML form.
$HTTP_POST_FILES[] $_FILES[] References to all files received, most commonly from HTML forms, using the POST method.
$HTTP_COOKIE_VARS[] $_COOKIE[] Any cookies returned from the client. The index key name matches the cookie name.
-- $_REQUEST[] A more recent addition that stores all user variables, including elements from the $_GET[], $_POST[], and $_COOKIE[] arrays. Prior to PHP4.3, this also includes the $_FILES[] array.
$HTTP_SERVER_VARS[] $_SERVER[] Information about the server session and the HTTP connection with the client.
$HTTP_ENV_VARS[] $_ENV[] Information about the server environment and system defined values.
$HTTP_SESSION_VARS[] $_SESSION[] IF PHP is being used for session management, this array is to store any session variables that need to be stored on the server between calls from the client.

    Key Search Strings:
'php data scope scripts for searching'
'php Passing Variables Between php Pages'
'php "programming style"'

Gotcha Keywords

    Extracted from PHP Coding Standard Due to my haphazard ways in the site I think that I need to do this everywhere.

  • :TODO: topic
    Means there's more to do here, don't forget.
  • :BUG: [bugid] topic
    means there's a Known bug here, explain it and optionally give a bug ID.
  • :KLUDGE:
    When you've done something ugly say so and explain how you would do it differently next time if you had more time.
  • :TRICKY:
    Tells somebody that the following code is very tricky so don't go changing it without thinking.
  • :WARNING:
    Beware of something.
  • :PARSER:
    Sometimes you need to work around a parser problem. Document it. The problem may go away eventually.
  • :ATTRIBUTE: value
    The general form of an attribute embedded in a comment. You can make up your own attributes and they'll be extracted.

    




Copyright © 2004-2004 All rights reserved.