function main() { $use_by_val = 123; $use_by_ref = 1000; $c = function ($arg, $dv = 500) use($use_by_val, &$use_by_ref) { $use_by_val *= 2; $use_by_ref *= 2; echo "Use: {$use_by_val} {$use_by_ref}\n"; funk($arg, $dv); }; if (!$c instanceof Closure) { echo "Closure isn't instanceof closure!\n"; } if (!is_callable($c)) { echo "Closure isn't callable!\n"; } $c(777); call_user_func($c, 888); var_dump($c); var_dump($use_by_val, $use_by_ref); }
<?php function funk($asi) { $asi = $asi * 2; return $asi; } $olemas = "asi"; $sedasi = "on küll jah"; $ah = "mis värk on?"; $üks_muutuja_veel_juurde = "lihtne"; echo funk(20);