3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static function test() { $main_category_currency = 1; $children = array( array('id_category'=>10), array('id_category'=>15), ); function map($child) { return $child['id_category']; } return array_unique(array_merge( array($main_category_currency), array_map("map",$children) )); } } var_dump(Test::test());
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
array(3) { [0]=> int(1) [1]=> int(10) [2]=> int(15) }
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
Fatal error: Constructor Test::test() cannot be static in /in/YlUlY on line 20
Process exited with code 255.

preferences:
81.82 ms | 402 KiB | 80 Q