<?php
$arr=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"
);
$newarray=array();
$s=sizeof($arr);
$ss=0;
foreach($ck as $ck2)
{
while($ss<$s)
{
$k = explode(".",$ck2);
if(sizeof($k) >1)
$newarray[$ss][$ck2]=$newarray,$arr[$ss][$k[0]][$k[1]];
else
$newarray[$ss][$ck2]=$newarray,$arr[$ss][$k[0]]);
$ss++;
}
}
print_r($newarray);
- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.25
- Parse error: syntax error, unexpected ',' in /in/d8cT1 on line 50
Process exited with code 255.
preferences:
176.66 ms | 1395 KiB | 62 Q