{{
number = 42
int typed = number
opposite = true
Array<String> strings = <String>["mammouth"]
echo strings[0].length
number = if opposite then -42 else 13
echo "I knew it!" if opposite?
square = int (int x) -> x * x
square(2)
fn Hello() ->
echo 'Hello Mammouth'
Hello()
num_list = [1, 2, 3, 4, 5]
obj = {
'square': square
'cube': fn (x) -> x * square(x)
}
squares = (square(num) for num in num_list)
squares = (square(num) for int num in num_list)
}}
<?php
$number = 42;
$typed = $number;
$opposite = TRUE;
$strings = array("mammouth");
echo strlen($strings[0]);
$number = $opposite ? -42 : 13;
if(isset($opposite)) {
echo "I knew it!";
}
$square = function($x) {
return $x * $x;
};
$square(2);
function Hello() {
echo 'Hello Mammouth';
}
Hello();
$num_list = array(1, 2, 3, 4, 5);
$obj = array('square' => square, 'cube' => function($x) {
return mammouth_call_method($x, "operator*", square($x));
});
$squares = call_user_func(function() {
global $num, $num_list;
$result = array();
for($i = 0; $i < count($num_list); $i++) {
array_push($result, $square($num_list[$i]));
}
return $result;
});
$squares = call_user_func(function() {
global $num, $num_list;
$result = array();
for($i = 0; $i < count($num_list); $i++) {
array_push($result, $square($num_list[$i]));
}
return $result;
});
?>