php - unable to load 2 xml elements

i can only load 1 elemet $row. i tried to make a new element $api but it doen't load it in my view. but the input of the $api is saved perfectley in my xml file. ALso when i Do a vardump, the input data shows. but i can't figure out why its dosn't load.
Here is my Load function
public function load()
{
$dom = new \DOMDocument();
$dom->load('config.xml');
//init
$array = array();
//get all form tags
$rows = $dom->getElementsByTagName('row');
$apis = $dom->getElementsByTagName('api');
foreach($rows as $row){
//get all field-tags from this form
$fields = $row->getElementsByTagName('field');
//create an empty element
$element = array('row');
//walk through the input elements of the current form element
foreach($fields as $field){
$name = $field->getAttribute('name');
$value = $field->nodeValue;
//add the data to element array
$element[$name] = $value;
}
//add the element to your array
$array[] = $element;
}
foreach($apis as $api){
//get all field-tags from this form
$fields = $api->getElementsByTagName('field');
//create an empty element
$element = array('api');
//walk through the input elements of the current form element
foreach($fields as $field){
$name = $field->getAttribute('name');
$value = $field->nodeValue;
//add the data to element array
$element[$name] = $value;
}
//add the element to your array
$array[] = $element;
}
//print it
$datas = $array;
// var_dump($datas);die;
return $datas;
}
Here is my view
@foreach ($datas as $data)
<tr id="data{{ $data['id'] }}">
<tr id="data{{ $data['api_id'] }}">
<td>
{{ $data['name'] }}<br>
<small>{{ $data['position'] }}</small>
</td>
<td>{{ $data['city'] }}</td>
<td>{{ $data['email'] }}</td>
<td>{{ $data['department'] }}</td>
<td>{{ $data,$api ?? ''['carname'] }}</td>
<td>{{ $data, $api ?? ''['age'] }}</td>
{{-- <td><img src="{{ $data['avatar'] }}" height="60" alt="avatar"></td>--}}
<td>
@if ($data['status'] === '1')
<h4><p class="label label-success round">Masuk
<p></h4>
@elseif ($data['status'] === '2')
please help me!
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.