3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Post { const TABLE = 'posts'; const TYPE = 'post'; static public function all() { $select = "SELECT * FROM `%s` WHERE `type` = '%s'\n"; echo sprintf($select, self::TABLE, self::TYPE); } } Post::all(); class Comment extends Post { const TYPE = 'comment'; } Comment::all(); echo '===='; class PostA { const TABLE = 'posts'; const TYPE = 'post'; static public function all() { $select = "SELECT * FROM `%s` WHERE `type` = '%s'\n"; echo sprintf($select, static::TABLE, static::TYPE); } } PostA::all(); // SELECT * FROM `posts` WHERE `type` = 'post' class CommentA extends PostA { const TYPE = 'comment'; } CommentA::all();

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.00916.38
8.3.50.0060.00916.40
8.3.40.0110.00318.59
8.3.30.0060.00818.85
8.3.20.0060.00320.15
8.3.10.0040.00423.62
8.3.00.0080.00017.50
8.2.180.0190.00318.54
8.2.170.0030.01422.96
8.2.160.0090.00620.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00419.21
8.2.120.0040.00426.35
8.2.110.0060.00319.30
8.2.100.0000.01118.09
8.2.90.0030.00619.26
8.2.80.0040.00417.97
8.2.70.0000.00817.38
8.2.60.0000.00817.93
8.2.50.0050.00318.10
8.2.40.0000.00820.36
8.2.30.0030.00521.02
8.2.20.0040.00418.14
8.2.10.0000.00718.09
8.2.00.0070.00018.09
8.1.280.0110.00725.92
8.1.270.0110.00422.20
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.48
8.1.230.0040.00917.45
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00817.35
8.1.190.0050.00317.11
8.1.180.0080.00018.10
8.1.170.0000.00719.02
8.1.160.0000.00819.01
8.1.150.0040.00420.57
8.1.140.0100.00019.55
8.1.130.0070.00018.96
8.1.120.0040.00417.45
8.1.110.0030.00717.39
8.1.100.0070.00017.51
8.1.90.0040.00417.40
8.1.80.0040.00417.47
8.1.70.0060.00317.49
8.1.60.0000.00917.56
8.1.50.0040.00417.39
8.1.40.0000.00817.41
8.1.30.0040.00417.67
8.1.20.0040.00417.70
8.1.10.0040.00417.48
8.1.00.0030.00617.58
8.0.300.0030.00618.77
8.0.290.0050.00316.75
8.0.280.0000.00818.40
8.0.270.0030.00317.34
8.0.260.0060.00016.84
8.0.250.0040.00416.87
8.0.240.0030.00516.86
8.0.230.0080.00016.98
8.0.220.0030.00316.80
8.0.210.0070.00016.91
8.0.200.0070.00017.00
8.0.190.0040.00416.97
8.0.180.0100.00016.82
8.0.170.0030.00416.94
8.0.160.0030.00516.80
8.0.150.0050.00316.88
8.0.140.0000.00716.86
8.0.130.0030.00313.32
8.0.120.0040.00416.91
8.0.110.0030.00516.76
8.0.100.0000.00716.86
8.0.90.0040.00416.73
8.0.80.0090.01316.97
8.0.70.0040.00416.69
8.0.60.0040.00416.73
8.0.50.0000.00716.79
8.0.30.0110.00717.13
8.0.20.0130.00617.40
8.0.10.0070.00016.98
8.0.00.0090.00916.67
7.4.330.0040.00415.55
7.4.320.0030.00316.63
7.4.300.0030.00316.61
7.4.290.0030.00316.61
7.4.280.0090.00016.62
7.4.270.0000.00616.61
7.4.260.0070.00016.47
7.4.250.0000.00716.56
7.4.240.0020.00516.45
7.4.230.0000.00716.64
7.4.220.0060.01116.72
7.4.210.0130.00716.65
7.4.200.0030.00316.28
7.4.160.0060.01316.43
7.4.150.0130.00317.40
7.4.140.0110.00717.86
7.4.130.0040.01316.54
7.4.120.0110.00716.51
7.4.110.0090.00916.27
7.4.100.0140.00316.43
7.4.90.0030.01416.58
7.4.80.0100.01019.39
7.4.70.0090.01316.45
7.4.60.0100.00716.61
7.4.50.0100.00716.13
7.4.40.0130.00916.39
7.4.30.0090.00616.48
7.4.00.0070.01015.00
7.3.330.0000.00913.30
7.3.320.0000.00513.28
7.3.310.0070.00016.09
7.3.300.0030.00316.16
7.3.290.0070.00816.33
7.3.280.0090.00816.29
7.3.270.0320.02517.40
7.3.260.0110.00716.52
7.3.250.0090.00916.31
7.3.240.0110.00616.31
7.3.230.0110.00616.34
7.3.210.0100.00716.27
7.3.200.0100.00716.21
7.3.190.0060.01116.53
7.3.180.0130.00216.30
7.3.170.0090.00616.41
7.3.160.0080.00816.44
7.2.330.0100.01016.78
7.2.320.0160.01016.78
7.2.310.0130.00316.28
7.2.300.0100.00716.62
7.2.290.0080.00816.34
7.2.60.0120.00316.86
7.2.00.0000.01119.48
7.1.200.0130.00715.55
7.1.100.0040.00418.32
7.1.70.0000.01616.86
7.1.60.0160.01634.96
7.1.50.0230.00634.82
7.1.40.0320.02034.42
7.1.30.0270.01834.51
7.1.20.0190.01334.54
7.1.10.0030.01216.41
7.1.00.0080.00816.63
7.0.200.0070.00716.63
7.0.190.0060.00916.86
7.0.180.0040.01116.27
7.0.170.0150.00916.15
7.0.160.0080.00816.31
7.0.150.0000.01716.15
7.0.140.0040.01116.37
7.0.130.0300.01016.29
7.0.120.0090.01416.54
7.0.110.0090.00916.19
7.0.100.0100.01016.23
7.0.90.0120.00816.18
7.0.80.0430.01314.57
7.0.70.0380.01414.48
7.0.60.0130.01115.89
7.0.50.0050.01516.26
7.0.40.0050.01016.18
7.0.30.0120.00816.27
7.0.20.0320.01214.48
7.0.10.0330.01314.47
7.0.00.0310.00914.59

preferences:
53.97 ms | 400 KiB | 5 Q