3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array=Array ( 0 => Array ( "Title" => "La science des rêves", "Year" => "2006", "Director" => Array ( "Name" => "Michel Gondry", "BirthYear" => "1963", "BirthPlace" => "Versailles, Yvelines, France" ) ), 1 => Array ( "Title" => "Arizona Dream", "Year" => "1992", "Director" => Array ( "Name" => "Emir Kusturica", "BirthYear" => "1954", "BirthPlace" => "Sarajevo, Bosnia and Herzegovina, Yugoslavia" ) ) ); $ck=Array ( 0 => "Title", 1 => "Director.Name", 2 => "Director.BirthYear" ); echo '<pre>'; print_r($array); echo '</pre>'; foreach($array as $final) { $final_array[] = array( 'title'=>$final['Title'], 'name'=>$final['Director']['Name'], 'birthyear'=> $final['Director']['BirthYear'] ); } echo '<pre>'; print_r($final_array); echo '</pre>'; echo $final_array[name];
Output for 5.3.0 - 7.1.0
<pre>Array ( [0] => Array ( [Title] => La science des rêves [Year] => 2006 [Director] => Array ( [Name] => Michel Gondry [BirthYear] => 1963 [BirthPlace] => Versailles, Yvelines, France ) ) [1] => Array ( [Title] => Arizona Dream [Year] => 1992 [Director] => Array ( [Name] => Emir Kusturica [BirthYear] => 1954 [BirthPlace] => Sarajevo, Bosnia and Herzegovina, Yugoslavia ) ) ) </pre><pre>Array ( [0] => Array ( [title] => La science des rêves [name] => Michel Gondry [birthyear] => 1963 ) [1] => Array ( [title] => Arizona Dream [name] => Emir Kusturica [birthyear] => 1954 ) ) </pre> Notice: Use of undefined constant name - assumed 'name' in /in/FMh6G on line 60 Notice: Undefined index: name in /in/FMh6G on line 60
Output for 4.3.0 - 5.2.17
<pre>Array ( [0] => Array ( [Title] => La science des rêves [Year] => 2006 [Director] => Array ( [Name] => Michel Gondry [BirthYear] => 1963 [BirthPlace] => Versailles, Yvelines, France ) ) [1] => Array ( [Title] => Arizona Dream [Year] => 1992 [Director] => Array ( [Name] => Emir Kusturica [BirthYear] => 1954 [BirthPlace] => Sarajevo, Bosnia and Herzegovina, Yugoslavia ) ) ) </pre><pre>Array ( [0] => Array ( [title] => La science des rêves [name] => Michel Gondry [birthyear] => 1963 ) [1] => Array ( [title] => Arizona Dream [name] => Emir Kusturica [birthyear] => 1954 ) ) </pre> Notice: Use of undefined constant name - assumed 'name' in /in/FMh6G on line 60 Notice: Undefined index: name in /in/FMh6G on line 60