nur-sery/nur_src/m/base/rows.php

22 lines
510 B
PHP

<?php
namespace nur\m\base;
use nur\A;
class rows {
static function vals(array $rows, ?string $name) {
if ($name !== null) return A::each_get($rows, $name);
$values = [];
foreach ($rows as $index => $row) {
$values[$index] = A::first($row);
}
return $values;
}
static function val(?array $row, ?string $name, $default) {
if ($row === null) return $default;
elseif ($name !== null) return A::get($row, $name, $default);
else return A::first($row, $default);
}
}