Beispiel #1
0
<?php

function test_lambda()
{
    $var = 1;
    $f = function ($a) use(&$var) {
        $var += $a;
    };
    $f(3);
    var_dump($var);
}
// let's go
test_lambda();
Beispiel #2
0
{
    try {
        echo 'Inside exceptionFunction()';
        throw new MyException('MyException thrown message');
    } catch (Exception $e) {
        echo $e;
    }
}
function loopException()
{
    while (true) {
        readline('Press any key to continue..');
        exceptionFunction();
    }
}
loopException();
$fn = test_lambda();
echo $fn('baz');
// Outputs barbaz
echo "Hello\n";
echo "World\n";
foo(42);
foo("hello");
foo(true);
foo(null);
foo(42.5);
foo();
class CLS
{
}
foo(new CLS());