$headers = array_column($data[0]['pages'], 'name');
$columns = array_column($data[0]['pages'], 'attribute');
$rowCount = max(array_map('count', $columns));
$headersHTML = implode('', array_map(function($n) {
return "<th>$n</th>";
}, $headers));
$rowsHTML = implode('', array_map(function($i) use($columns) {
return "
<tr>".implode('', array_map(function($n) use($i) {
return "<td>".($n[$i] ?? '')."</td>";
}, $columns))."
</tr>";
}, range(0, $rowCount - 1)));
echo "
<table>
<thead>
<tr>$headersHTML</tr>
</thead>
<tbody>$rowsHTML</tbody>
</table>";
u
:preg_match_all("/[а-я]{4,}/ui", $string, $keywords);
$result = implode(',', array_column(json_decode($str, true), 'v'));
preg_match_all('~(?<="v": )\d+~', $str, $match);
$result = implode(',', $match[0]);
preg_match('~(\d+)\D*\.\D*(\d+)~', $str, $match);
$result = implode('.', array_slice($match, 1));
preg_match('~\d{2}\.\d{1,2}~', preg_replace('~[^\d.]~', '', $str), $match);
$result = $match[0];
$sql = "{$action} * FROM {$table} WHERE {$field} {$operator} ?";
DELETE * FROM ...
. Круто. Не знал, что так можно. Или всё-таки нельзя? $keys = array_keys($arr);
$newArr = array_combine($keys, array_map(null, $arr, array_slice($keys, 1)));
preg_match_all('~(?<=<p>).+?(?=</p>)~', $str, $match);
$data = array_map(function($n) {
return explode('-', $n, 2);
}, $match[0]);