3v4l.org

run code in 300+ PHP versions simultaneously
<?php $literature = []; $literature['authors'] = [ ['name' => 'hhh', 'adress' => 'hemingway@oldtimers.com','yearOfBirth' => '1869'], ['name' => 'yyy', 'adress' => 'saintexupéry@oldtimers.com','yearOfBirth' => '1900'], ['name' => 'zzz', 'adress' => 'conandoyle@oldtimers.com','yearOfBirth' => '1859'] ]; $literature['books'] = [ ['title' => 'ggg', 'author' => $literature ['authors'][0]['name'], 'year' => 1943], ['title' => 'uuu', 'author' => $literature ['authors'][0]['name'], 'year' => 1887], ['title' => 'ttt!', 'author' => $literature ['authors'][0]['name'], 'year' => 1929], ['title' => 'vvv', 'author' => $literature ['authors'][0]['name'], 'year' => 1936], ['title' => 'ooo', 'author' => $literature ['authors'][0]['name'], 'year' => 1938] ]; print_r($literature);
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.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Array ( [authors] => Array ( [0] => Array ( [name] => hhh [adress] => hemingway@oldtimers.com [yearOfBirth] => 1869 ) [1] => Array ( [name] => yyy [adress] => saintexupéry@oldtimers.com [yearOfBirth] => 1900 ) [2] => Array ( [name] => zzz [adress] => conandoyle@oldtimers.com [yearOfBirth] => 1859 ) ) [books] => Array ( [0] => Array ( [title] => ggg [author] => hhh [year] => 1943 ) [1] => Array ( [title] => uuu [author] => hhh [year] => 1887 ) [2] => Array ( [title] => ttt! [author] => hhh [year] => 1929 ) [3] => Array ( [title] => vvv [author] => hhh [year] => 1936 ) [4] => Array ( [title] => ooo [author] => hhh [year] => 1938 ) ) )

preferences:
133.57 ms | 413 KiB | 5 Q