<?php
$array = [
["firstname" => "John", "lastname" => "", "email" => "", "uri" => ""],
["firstname" => "", "lastname" => "Smith", "email" => "", "uri" => ""],
["firstname" => "", "lastname" => "", "email" => "john@example.org", "uri" => ""]
];
$result = array_shift($array); // remove the first row and push it into the result array
foreach ($array as $row) {
$result = array_merge($result, array_filter($row, 'strlen')); // merge only non-empty elements into the result
}
var_export($result);
preferences:
23.29 ms | 407 KiB | 5 Q