Warning: invalid offset type
I have this var from xml output
var_dump($key);
give it to me
object(SimpleXMLElement)#11 (1) { [0]=> string(5) "Cairo" }
now I want to make "Cairo" as a key to get its value as
$lang[] = array('Cairo' => "Cairo city");
an error occurs while doing this
echo $lang[$key];
and this will give me "Warning: Illegal offset type" because of the key is SimpleXMLElement
how can I make this a regular var?
source
share