!! article
Template:Get random argument
!! text
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
!! endarticle
!! article
Template:Echo
!! text
{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}
!! endarticle
!! article
Template:Dump
!! text
This is the Dump template
foreach ( $argv as $key => $value ) {
echo "\n* $key => $value";
}
echo "\n";
!! endarticle
!! test
Get random argument
!! input
{{Get random argument | One }}
!! result
One
!! end
!! test
Transclude Echo
!! input
echo "Hello\n\n";
$foo = transclude( "Echo", ['1', '22', '333', '4444'] );
echo "\n\n$foo";
echo "\n\nBye";
!! result
Hello
1223334444
Bye
!! end
!! test
Transclude Echo2
!! input
echo "Hello\n\n";
$foo = transclude( "Echo", ['1', '22', '333', '4444'], null );
echo "\n\nBye";
echo "\n\n$foo";
!! result
Hello
Bye
1223334444
!! end
!! test
Transclude Echo3
!! input
echo "Hello\n\n";
echo transclude( false, [], '{{Echo|1|22|333|4444}}' );
echo "\n\nBye";
!! result
Hello
1223334444
Bye
!! end
!! test
Transclude Dump
!! input
echo "Hello\n\n";
echo transclude( "Dump", ['1', '22', '333', '4444', 'test'=>'TEST'] );
echo "\n\nBye";
!! result
Hello
- 0 => Template:Dump
- 1 => 1
- 2 => 22
- 3 => 333
- 4 => 4444
- test => TEST
Bye
!! end
!! article
Transclude Loop
!! text
echo "Hello\n\n";
transclude( ":Transclude Loop", ['1', '22', '333', '4444', 'test'=>'TEST'] );
echo "\n\nBye";
!! endarticle
!! test
Transclude Loop detected
!! input
{{:Transclude Loop}}
!! result
Hello
PhpTags Warning: transclude(): Template loop detected in Transclude Loop on line 3
Bye
!! end