3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Outside of the application, e.g. DB or some storage. function addSomeIntegerFieldToDB($value) { $sql = 'INSERT INTO mytable (integer_field) VALUES (:int)'; // $st = $pdo->prepare($sql); // $st->execute(array('int' => $value); } // the application: global $conditional $conditional = true; class X { public function doSmth($id) { // Assertion will run independently of $conditional, thus preventing a wrong $id to be passed to ->doSmth() method assert(is_int($id), \Exception('wot ar y doin')); global $conditional; if ($conditional) { addSomeIntegerFieldToDB($id); } } } $obj = new X; $obj->doSmth(13);

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)
7.0.20.0200.07020.33
7.0.10.0130.07320.06
7.0.00.0070.08020.23
5.6.170.0230.08020.40
5.6.160.0070.08320.57
5.6.150.0100.04018.26
5.6.140.0100.05718.19
5.6.130.0030.07718.28
5.6.120.0100.08321.02
5.6.110.0100.08720.90
5.6.100.0100.08321.14
5.6.90.0070.07720.98
5.6.80.0030.05020.54
5.5.310.0270.08020.36
5.5.300.0000.05718.04
5.5.290.0170.08017.98
5.5.280.0070.08320.77
5.5.270.0200.07020.88
5.5.260.0000.06320.84
5.5.250.0170.06320.46
5.5.240.0200.05020.19

preferences:
140.02 ms | 1394 KiB | 7 Q