3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Entity extends PDO { public function __construct() { try { parent::__construct('mysql:host=localhost;dbname=X', 'db_user', 'db_pass'); parent::setAttributes(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { die($e->getMessage()); }} } class DataSource { public static function simple_select($sql, array $values) { $smpt = (new Entity)->Prepare($sql); $smpt->execute($values); return $smpt->fetchAll(); } } class UniqueString { private $Secret; public function __construct($secret) { $this->Secret = $secret; } public function fetch() { return $this->Secret; } } class Generate { private static $Secret; private static $Sql = 'SELECT user_id FROM users WHERE salt = ?'; public static function randomString(int $len) { do { self::$Secret = mcrypt_create_iv($len, MCRYPT_DEV_URANDOM); } while (!empty(DataSource::simple_select(self::$Sql, [self::$Secret])['user_id'])); return new UniqueString(self::$Secret); } } echo Generate::randomString(16)->fetch();

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.3.60.0060.01516.63
8.3.50.0080.00721.95
8.3.40.0070.00718.83
8.3.30.0190.00318.68
8.3.20.0050.00320.61
8.3.10.0050.00321.77
8.3.00.0080.00021.73
8.2.180.0070.01416.50
8.2.170.0040.01222.96
8.2.160.0110.00322.08
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0030.00526.16
8.2.120.0080.00019.25
8.2.110.0080.00320.93
8.2.100.0110.00017.66
8.2.90.0000.00817.91
8.2.80.0030.00718.03
8.2.70.0000.00817.63
8.2.60.0040.00417.63
8.2.50.0000.00817.63
8.2.40.0030.00620.57
8.2.30.0000.00719.20
8.2.20.0000.00717.94
8.2.10.0000.00717.93
8.2.00.0000.00717.71
8.1.280.0170.00325.92
8.1.270.0060.00322.09
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00023.78
8.1.230.0060.00622.75
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0040.00417.23
8.1.190.0120.00416.88
8.1.180.0040.00419.01
8.1.170.0040.00418.54
8.1.160.0070.00022.14
8.1.150.0000.00820.26
8.1.140.0040.00419.40
8.1.130.0000.00720.77
8.1.120.0000.00817.39
8.1.110.0000.00817.33
8.1.100.0040.00417.35
8.1.90.0050.00217.36
8.1.80.0070.00017.25
8.1.70.0040.00717.39
8.1.60.0040.00417.57
8.1.50.0030.00617.38
8.1.40.0000.01117.54
8.1.30.0000.00817.51
8.1.20.0040.00417.52
8.1.10.0040.00417.43
8.1.00.0040.00417.34
8.0.300.0040.00419.98
8.0.290.0000.00816.63
8.0.280.0000.00718.33
8.0.270.0030.00317.20
8.0.260.0030.00320.32
8.0.250.0070.00016.89
8.0.240.0030.00317.01
8.0.230.0030.00317.00
8.0.220.0040.00416.88
8.0.210.0030.00316.80
8.0.200.0040.00416.89
8.0.190.0020.00516.98
8.0.180.0000.00716.86
8.0.170.0070.00016.84
8.0.160.0080.00016.84
8.0.150.0030.00316.86
8.0.140.0000.00816.92
8.0.130.0030.00313.39
8.0.120.0030.00616.78
8.0.110.0070.00016.81
8.0.100.0040.00416.86
8.0.90.0040.00416.95
8.0.80.0120.00316.83
8.0.70.0030.00516.90
8.0.60.0000.00716.80
8.0.50.0070.00016.86
8.0.30.0120.00717.17
8.0.20.0090.01217.40
8.0.10.0030.00616.91
8.0.00.0100.00716.46
7.4.330.0000.00615.55
7.4.320.0100.00016.33
7.4.300.0000.00616.56
7.4.290.0000.00716.51
7.4.280.0000.00716.38
7.4.270.0030.00316.59
7.4.260.0060.00316.44
7.4.250.0080.00016.53
7.4.240.0000.00816.59
7.4.230.0000.00716.66
7.4.220.0130.01316.41
7.4.210.0090.00916.59
7.4.200.0000.00716.64
7.4.160.0100.00816.52
7.4.150.0090.00917.40
7.4.140.0090.00917.86
7.4.130.0090.01016.55
7.4.120.0130.00516.40
7.4.110.0070.01116.53
7.4.100.0110.00616.38
7.4.90.0070.01016.64
7.4.80.0100.00619.39
7.4.70.0070.01016.51
7.4.60.0060.00916.27
7.4.50.0100.00316.43
7.4.40.0040.02016.28
7.4.30.0040.01416.34
7.4.00.0030.01515.12
7.3.330.0000.00513.35
7.3.320.0030.00313.45
7.3.310.0070.00016.44
7.3.300.0070.00016.39
7.3.290.0090.01016.34
7.3.280.0090.00816.35
7.3.270.0190.00417.40
7.3.260.0100.00716.51
7.3.250.0060.01116.53
7.3.240.0100.00816.37
7.3.230.0060.01016.39
7.3.210.0140.00316.41
7.3.200.0000.01616.52
7.3.190.0090.01016.59
7.3.180.0120.00916.24
7.3.170.0130.00316.34
7.3.160.0080.00816.41
7.3.120.0090.00914.70
7.3.110.0060.01214.82
7.3.100.0090.00314.88
7.3.90.0030.00914.86
7.3.80.0080.00314.79
7.3.70.0090.00914.84
7.3.60.0070.00814.93
7.3.50.0030.01114.91
7.3.40.0060.00914.78
7.3.30.0060.00314.58
7.3.20.0100.00716.50
7.3.10.0070.00716.51
7.3.00.0110.00216.72
7.2.330.0120.00616.52
7.2.320.0030.01316.73
7.2.310.0130.01016.37
7.2.300.0090.01216.63
7.2.290.0090.00916.41
7.2.250.0110.00714.80
7.2.240.0000.01714.93
7.2.230.0040.01114.86
7.2.220.0100.00315.03
7.2.210.0090.00814.93
7.2.200.0070.00715.05
7.2.190.0040.00815.00
7.2.180.0080.00415.12
7.2.170.0100.00614.84
7.2.130.0140.00516.57
7.2.120.0190.00316.46
7.2.110.0040.00816.78
7.2.100.0030.01316.71
7.2.90.0060.00916.65
7.2.80.0030.01016.51
7.2.70.0110.00316.80
7.2.60.0050.00716.88
7.2.50.0060.00916.71
7.2.40.0100.00316.54
7.2.30.0000.01716.86
7.2.20.0000.01216.86
7.2.10.0130.00316.70
7.2.00.0080.00416.84
7.1.330.0090.00615.57
7.1.320.0040.01215.74
7.1.310.0070.00715.51
7.1.300.0030.01015.60
7.1.290.0070.01015.77
7.1.280.0000.01415.47
7.1.270.0000.01615.52
7.1.260.0110.00015.63
7.1.250.0130.00315.63
7.1.200.0070.00715.27
7.1.100.0070.00317.94
7.1.70.0040.00416.91
7.1.60.0060.01217.31
7.1.50.0100.01016.95
7.1.00.0030.07722.42
7.0.200.0040.00416.41
7.0.120.0170.06020.27
7.0.110.0100.06020.20
7.0.100.0130.06020.32
7.0.90.0230.04720.34
7.0.80.0200.05320.38
7.0.70.0100.05720.41
7.0.60.0100.05719.95
7.0.50.0070.06020.36
7.0.40.0070.06020.44
7.0.30.0400.05020.38
7.0.20.0070.06020.30
7.0.10.0030.06020.29
7.0.00.0170.06320.28
5.6.270.0130.06021.10
5.6.260.0070.06020.93
5.6.250.0200.04721.08
5.6.240.0130.05320.91
5.6.230.0100.08721.09
5.6.220.0200.05021.09
5.6.210.0100.05320.98
5.6.200.0170.05020.90
5.6.190.0070.06720.86
5.6.180.0170.04720.86
5.6.170.0130.05021.04
5.6.160.0030.07720.86
5.6.150.0170.04720.86
5.6.140.0170.04720.87
5.6.130.0070.05720.88
5.6.120.0170.05020.89
5.6.110.0070.06021.05
5.6.100.0100.05721.03
5.6.90.0130.05020.95
5.6.80.0130.04720.40
5.6.70.0100.05320.42
5.6.60.0100.05320.23
5.6.50.0070.05320.21
5.6.40.0130.04720.39
5.6.30.0070.05720.39
5.6.20.0030.06020.39
5.6.10.0170.04020.45
5.6.00.0100.05320.38

preferences:
60.2 ms | 401 KiB | 5 Q