Answer the question
In order to leave comments, you need to log in
How to use a SimpleXMLElement as an associative array key?
In general, there is such an xml document:
<Domains>
<DomainData IsValid="true">
<DomainName>mozilla.com</DomainName>
<Values>
<Data>
<Parameter>Cy</Parameter>
<Value xsi:type="CyApiData">
<Cy>12000</Cy>
<Yaca>0</Yaca>
<YaBarMirrow>0</YaBarMirrow>
</Value>
</Data>
</Values>
</DomainData>
foreach($sessionData->Domains->DomainData as $domain)
{
// Доменное имя
echo $domain->DomainName."<br/>";
$str = $domain->DomainName;
foreach($domain->Values->Data as $data)
{
echo $data->Parameter."<br/>";
echo $data->Value."<br/>";
foreach(get_object_vars($data->Value) as $paramKey => $paramValue)
{
//echo "{$paramKey} = {$paramValue}"."<br/>";
if( stristr($paramKey,"cy") )
{
//$out_array["domain"][] = $domain->DomainName;
//$out_array["domain"]["cy"][] = $paramValue;
$out_array[$str][] = $paramValue;
}
}
}
echo "<br/>";
Warning: Illegal offset type in C:\xampp\htdocs\w\functions\domain.php on line 1
19
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question