3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tag {}; $setTags = []; function setTags(array $tags) use (&$setTags) { array_map( function (Tag $tag) { $setTags[] = $tag; }, $tags ); } var_dump($setTags); setTags( [ new Tag(), new Tag(), new Tag(), new Tag(), ] ); var_dump($setTags);
Output for 5.6.0 - 5.6.26, 7.0.0 - 7.0.12
Parse error: syntax error, unexpected 'use' (T_USE), expecting '{' in /in/fJuP5 on line 4
Process exited with code 255.

preferences:
176.15 ms | 1395 KiB | 47 Q