3v4l.org

run code in 300+ PHP versions simultaneously
<?php //sql hard in code for now (generated sql normally //var_dump of type shows 'ss' => string(2) "ss" //var dump of $params shows: array(2) { [0]=> string(7) "renault" [1]=> string(20) "Alaskan" } //SQL ERROR : //Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables public function getSomething(string $sql, string $type, array $params): array { $result = array(); $statement = $this->connection->prepare($sql); $sql = "SELECT * FROM housemark WHERE merk LIKE ? AND (model LIKE ?) GROUP BY form ORDER BY form"; if ($statement) { //call_user_func_array(array(&$statement, 'bind_param'), makeValuesReferenced($params)); var_dump(makeValuesReferenced(array("mark1", 'model1'))); //neither of this one works //$statement->bind_param($type, makeValuesReferenced($params)); // $statement->bind_param("ss", makeValuesReferenced(array("renault", 'alaskan'))); if ($statement->execute()) { $statement->store_result(); var_dump($statement); if ($statement->num_rows >= 1) { $statement->bind_result($id, $mark, $model, $form); while ($rij = $statement->fetch()) { $result[] = new Housemark($id, $mark, $model, $form); } } } } var_dump($this->connection->error); return $result; } function makeValuesReferenced(array $arr): array { $refs = array(); foreach ($arr as $key => $value) $refs[$key] = &$arr[$key]; return $refs; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.0.00.0130.01017.86
7.4.140.0030.02117.86
7.4.130.0130.00517.86
7.4.120.0140.00717.86
7.4.110.0150.00617.86
7.4.100.0190.00017.86
7.4.90.0090.00917.86
7.4.80.0160.00917.86
7.4.70.0050.01417.86
7.4.60.0100.01417.86
7.4.50.0140.00717.86
7.4.40.0080.01217.86
7.4.30.0100.01317.86
7.4.20.0100.01317.86
7.4.10.0150.01217.86
7.4.00.0150.00417.86
7.3.260.0140.00717.86
7.3.250.0090.00917.86
7.3.240.0090.01017.86
7.3.230.0120.00617.86
7.3.220.0100.00717.86
7.3.210.0110.00817.86
7.3.200.0240.00317.86
7.3.190.0190.00017.86
7.3.180.0130.01017.86
7.3.170.0100.01317.86
7.3.160.0090.01317.86
7.3.150.0110.00717.86
7.3.140.0180.00817.86
7.3.130.0150.00417.86
7.3.120.0090.01517.86
7.3.110.0120.01217.86
7.3.100.0090.01417.86
7.3.90.0170.00717.86
7.3.80.0190.00617.86
7.3.70.0080.01617.86
7.3.60.0100.01117.86
7.3.50.0090.00917.86
7.3.40.0100.01317.86
7.3.30.0110.00717.86
7.3.20.0820.01217.86
7.3.10.0140.01117.86
7.3.00.0130.01217.86

preferences:
153.89 ms | 1263 KiB | 7 Q