3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = Array ( '0' => Array ( 'firstName' => 'Hadi', 'lastName' => 'Pratama', 'age' => 22 ), '1' => Array ( 'firstName' => 'Jefri', 'lastName' => 'Ronaldo', 'age' => 21 ), '2' => Array ( 'firstName' => 'Rizky', 'lastName' => 'Aulia', 'age' => 20 ) ); echo json_encode($a);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.20, 8.1.0 - 8.1.7
[{"firstName":"Hadi","lastName":"Pratama","age":22},{"firstName":"Jefri","lastName":"Ronaldo","age":21},{"firstName":"Rizky","lastName":"Aulia","age":20}]

preferences:
49.13 ms | 410 KiB | 5 Q