Extension:PhpTags Functions/Functions/Array

From mediawiki.org
Jump to navigation Jump to search

Example of usage Array functions[edit]

As an example, the template that returns a random value from arguments:

array_shift( $argv ); # $argv is array that contains the passed parameters ($argv[0] is always page name, need to remove it here)
shuffle ( $argv ); # shuffles the array
$return = array_pop( $argv ); # get the last value of the array
echo trim( $return ); # the string can contain unnecessary spaces, remove them


Note Note: information about the PhpTags extension is available in the quick start guide.
Note Note: these functions are similar to the native PHP functions, so you can use PHP documentation