$real = 3.1495;
echo "number : {$number}" . PHP_EOL;
echo "real: {$real}" . PHP_EOL;
$total = $real + $number;
echo "total: " . $total . PHP_EOL;
$newAr = array();
$newAr[] = 5;
$newAr[] = 10;
$newAr[] = 20;
$newAr[] = "cats";
$newAr[] = 4.78;
$newAr["animal"] = "frog";
echo "array iteration begins:" . PHP_EOL;
foreach ($newAr as $element) {
    echo "array element: {$element}" . PHP_EOL;
}
var_dump($newAr);
function testFunc($count)
{
    $output = array();
    $cl = new TestClass();
    $cl->doStuff();
    for ($i = 0; $i < $count; $i++) {
        $output[] = $i;
    }
    return $output;
}
$results = testFunc(20);
print_r($results);
$results = testFunc(50);
print_r($results);
<?php

function testfunc()
{
    echo 'a<br>';
}
testFunc();
override('testFunc', '', '');
testFunc();
Example #3
0
    echo json_encode($result);
});
$app->get('/komponentti/:id/pretty', function ($id) {
    $result = getKompoData($id);
    echo "<pre>";
    echo json_encode($result, JSON_PRETTY_PRINT);
    echo "</pre>";
});
$app->get('/komponentti/:id/debug', function ($id) {
    $result = getKompoData($id);
    echo "<pre>";
    var_dump($result);
    echo "</pre>";
});
$app->get('/testfunc/', function () {
    $result = testFunc();
    echo "<pre>";
    var_dump($result);
    echo "</pre>";
});
$app->get('/debug/:month', function ($month) {
    $result = debugFunc($month);
    echo "<pre>";
    echo json_encode($result, JSON_PRETTY_PRINT);
    echo "</pre>";
});
$app->get('/login/:username/:password', function ($username, $password) {
    $result = login($username, $password);
    echo json_encode($result);
});
$app->post('/tarkastus', function () {
<?php

testFunc($someParam, $flag & $anotherFlag);
<?php

function testFunc($obj)
{
    $obj->property = 'new value';
}
$obj = (object) ['property' => 'old value'];
var_dump($obj);
testFunc($obj);
var_dump($obj);
<?php

testFunc($someParam, &$otherParam);
testFunc($someParam, &$otherParam);