Hi there,
As a newbie I need your help in getting multidimensional array from simplexml object.
suppose my array is like:
just for getting idea:
Here $data is a simplexml object contains below xml:
<users>
<user>
<id></id>
<nm></nm>
<gender>
<male></male>
<female></female>
</gender>
</user>
</users>
Here I an perfectly getting array of each user, but in that array when it comes to gender, it shows nothing. i need array of gender too. I am using following code:
foreach($data->users as $users)
{
$arr1 = array();
foreach($users as $user)
{
foreach($user as $k=>$v)
{
$arr1[$k] = (string) $v;
}
}
$arr2[] = $arr1;
}
Any suggestion?