PHP

 
 
PHP (= Hypertext Preprocessor) is an HTML-embedded server-side scripting language.

PHP is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE information.

More information about PHP can be found at: http://www.php.net

PHP manuals can be found at:
http://www.php.net/manual/en/
http://devzone.zend.com/manual/

The latest PHP version can be downloaded from: http://www.php.net/downloads.php

rss feed






Coding issues.



Information
none


Function Description
include() include() and require() are identical in every way except how they handle failure. include() produces a Warning and continues with the processing of the page.

Example:
<?php
   include('file.php'); /* file.php does not exist */
?>
require() require() and include() are identical in every way except how they handle failure. require() produces a Fatal Error which halts the processing of the page.

Example:
<?php
   require('file.php'); /* file.php does not exist */
?>


Operator Description
. Concatenate operator.
It concatenate strings.

Example:
<?php
   $firstname = 'John';
   $lastname = 'Smith';
   echo $firstname . ' ' . $lastname;
?>
@ Error control operator.
When prepended to an expression any error messages that might be generated by that expression will be ignored.

Example:
<?php
   @include('file.php');
?>



Keywords Description
global Variables have a single scope which includes required and included files. Any variables in user-defined functions have a local function scope.

Example 1:

File test.inc:
<?php
   echo $a . ' world';
?>


File main.php
<?php
   $a = 'hello'; /* global scope */

   function showMessage() {
      echo '<br />';
      echo $a; /* reference to local scope variable */
   }

   include('test.inc');
   showMessage();
?>


Example 1 shows only:
hello world

Example 2:

File test.inc:
<?php
   echo $a . ' world';
?>


File main.php
<?php
   $a = 'hello'; /* global scope */

   function showMessage() {
      global $a;
      echo '<br />';
      echo $a; /* reference to local scope variable */
   }

   include('test.inc');
   showMessage();
?>


Example 2 shows:
hello world
hello