3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Variable variable. $a = 'b'; $b = 'target'; var_dump($$a == $b); // Anon function with inclusion of scope. $fn = function($c) { var_dump($$c == 'target'); }; $fn($a); // I can use scope within using variable variable. $fn = fn($c) => $$c == 'target'; var_dump($fn($a)); // I can't return it though. $fn = fn($c) => $$c; var_dump($fn($a));

preferences:
24 ms | 404 KiB | 5 Q