Extension:PhpTags/Quick start guide

Usage
There are two ways to use this extension on the wiki pages, and each of them has its own features.

The main way is to place the PHP code between the tags  and. In this case PhpTags returns "Strip marker" and the result is sent for processing to the MediaWiki Parser.

Another way is to use PhpTags as the parser function:

In this case PhpTags returns string that can be processed by other parser functions.
 * This string can also contain "Strip marker", if were used the functions which returns it.

Illustrative examples are given here.

Short syntax
For ease of use it is possible to use the short syntax.

Examples here

PhpTags Code
PHP is easy to learn and popular programming language and PhpTags designed so to be as similar to native PHP. Thus any PHP code should work correctly in PhpTags.
 * PhpTags is an implementation of Magic expressions, rather than an alternative implementations of the PHP.
 * PhpTags does not contain any implementation constants, regular functions and objects, so their availability and results of the call depends on additional installed compatible extensions. A large number of native PHP functions implemented in Extension:PhpTags Functions. You just need to install it.
 * If several extensions implement one and the same constant, function, or object, for processing will be caused by extension that is the late in LocalSettings.php

Variable scope
The scope of a variable is the context within which it is defined. For the most part all PhpTags variables only have a single scope. Any variable used inside a page is by default limited to the local page scope.
 * In PhpTags (just like in PHP) global variables must be declared global inside a page if they are going to be used in that page.

A clear demonstration


 * just like in PHP a second way to access variables from the global scope is to use the special PhpTags-defined $GLOBALS array.

Demonstration of global variables.

Another important feature of variable scoping is the static variable. A static variable exists only in a local page scope, but it does not lose its value when PhpTags execution leaves this scope.

Demonstration of static variables.

Template parameters
The parameters that will be passed in when the template is used available through the the special PhpTags-defined $argv array.
 * the first argument $argv[0] is always the page name on which there is an appeal to this variable.

Example