Open main menu

Extension:PhpTags Functions/Functions/Array

Example of usage Array functionsEdit

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

<phptag>
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
</phptag>

Demo

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