I have an array ,vehicle owners and tools are available, there is no stability in the array there are three car owners,vehicles they own show. in short; I have 3 car owners and I wanted to show on the page which of these three vehicles are ford, male, scania

code it gives me
[enter image description here](https://i.stack.imgur.com/yWEPY.png)

i want to do
[enter image description here](https://i.stack.imgur.com/mOUWA.png)

```
<?php 
$vehicles = array(

    array(
     "vehicleowner" =>("john"),
     "vehicles" =>array(
     array(
      "id" =>(1),
      "model" =>("ford"),
      "brand"   =>(1830),   
     ),      
     array(
      "model" =>("scania"),
      "id" =>(2),
      "brand"   =>("r400"), 
     ),
     array(
      "id" =>(3),
      "model" =>("man"),
      "brand"   =>("tgx"),  
     )
     ),
     ),

    array(
     "vehicleowner" =>("alex"),
     "vehicles" =>array(
     array(
      "id" =>(1),
      "model" =>("ford"),
      "brand"   =>(1830),   
     ),      
     array(
      "id" =>(3),
      "model" =>("man"),
      "brand"   =>("tgx"),  
     )
     ),
     ),

     array(
     "vehicleowner" =>("Robert"),
     "vehicles" =>array(
     array(
      "id" =>(1),
      "model" =>("ford"),
      "brand"   =>(1830),   
     ),      
     array(
      "model" =>("scania"),
      "id" =>(2),
      "brand"   =>("r400"), 
     ),
     array(
      "id" =>(3),
      "model" =>("man"),
      "brand"   =>("tgx"),  
     )
     ),
     ),

 );

echo '<table border="1">
<thead>
<tr>
<td>vehicleowner</td>
<td>Ford</td>
<td>Scania</td>
<td>Man</td>
';

foreach($vehicles as $i => $value){
     // echo "<pre>";
    // print_r($value);

    $ford = $value["vehicles"][$i]["id"]==1;            

    if($ford){ $fordd = $value["vehicles"][$i]["brand"];}       

    $scania = $value["vehicles"][$i]["id"]==2;          
    if($scania){ $scaniaa = $value["vehicles"][$i]["brand"];}

    $man = $value["vehicles"][$i]["id"]==3;         
    if($man){ $mann = $value["vehicles"][$i]["brand"];}

?>

 <tr>
 <td><?php echo $value["vehicleowner"]?></td>
 <td><?php echo isset($fordd) ? $fordd : '-';?></td>
 <td><?php echo isset($scaniaa) ? $scaniaa : '-';?></td>
 <td><?php echo isset($mann) ? $mann : '-';?></td>

 <tr>

<?php } ?>

```