Need to fetch All results from SQLite3Result to multiarray

Solution 1:

This is the easiest way to fetch data from database in SQLite3 in php

$db = new SQLite3('mysqlitedb.db');
$results = $db->query('SELECT bar FROM foo');
while ($row = $results->fetchArray()) {
    var_dump($row);
}

Solution 2:

As stated in the comments you can extend something like:

<?php
$x = new SQLite3_1('xx.db');
//see: http://www.icosaedro.it/phplint/phplint2/doc/modules/sqlite3.html
class SQLite3_1 extends SQLite3
{
    public function __construct($filename,int $flags = 6, string $encryption_key = "")
    {
        parent::__construct($filename,$flags,$encryption_key);
    }
    public function fetchAll()
    {
        //own implementation with a FOR (is faster than a foreach)
    }
    public function numberResults()
    {
        //helpfull
    }
}
?>

It is not elegant as you stated but when migrating to different servers (and different versions of PHP) you won't have headaches this way