$array = array_map('trim', file('file.txt'), $array);
$array = array_map(function ($line) { preg_match("/([0-9]+)?.([0-9]+)$/i", $line, $matches);
return $matches;
}, $array);
echo '<pre>' . print_r($array, true);
public static function whereOne($query, array $attributes): ?object
{
$stmt = self::$db->prepare('SELECT * FROM `' . static::getTableName() . '` WHERE ' . $query);
$stmt->execute([$attributes]);
$r = $stmt->fetch();
return $r ? new static($r) : null;
}
public static function whereCollection($query, array $attributes): ?array
{
$stmt = self::$db->prepare('SELECT * FROM `' . static::getTableName() . '` WHERE ' . $query);
$stmt->execute([$attributes]);
$r = $stmt->fetchAll();
$c = sizeof($r);
if ($c > 0) {
for ($i = 0; $i < $c; $i++) {
$r[$i] = new static($r[$i]);
}
return $r;
}
return null;
}
Возможно в него можно чистый запрос прокинуть
select a.test + min(b.test2) as mysum from test left join test2 on...