i've created a complex script for parser datas from XML.
At the end of this, i have this:
$xmlArray['Event'][$k]['Name event']= $nameVal;
$xmlArray['Event'][$k][$i]['Type event']= $typeVal;
If i try to parse datas with
echo '<pre>';
print_r($xmlArray);
echo '</pre>';
Seems to be ok.
Now i need to save this data for Wordpress variables. Im trying with this but not works:
foreach($xmlArray as $k => $v){
if(is_array($v) && count($v) > 0){
foreach($v as $key => $value){
$event = array();
$name = $value['Name Event']; --> IS OK
$type = $value[$event][$key]['Type event']; --> Not work, i get error Illegal offset
echo "$name<br>";
echo "$type<br>";
}
} else {
}
How can i fix it ??
You're using an empty array as a key:
Array keys can only be strings or numbers. You can't use an object, you can't use another array, etc..