3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fa () { return 1; } function fb () { return 1; } function fc () { return 1; } $calla = 'fa'; $callb = 'fb'; $callc = 'fc'; $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; $x += $calla(); $x += $callb(); $x += $callc(); if( $x != 3 ) die( 'Bad numbers' ); } echo( "Variable functions took " . (microtime( true ) - $time) . " seconds.<br />" ); $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; $x += call_user_func('fa', ''); $x += call_user_func('fb', ''); $x += call_user_func('fc', ''); if( $x != 3 ) die( 'Bad numbers' ); } echo( "call_user_func took " . (microtime( true ) - $time) . " seconds.<br />" ); $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; eval( '$x += ' . $calla . '();' ); eval( '$x += ' . $callb . '();' ); eval( '$x += ' . $callc . '();' ); if( $x != 3 ) die( 'Bad numbers' ); } echo( "eval took " . (microtime( true ) - $time) . " seconds.<br />" ); ?>

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.1.70.0090.03517.29
7.4.00.0130.05514.80
7.3.120.0030.03814.55
7.3.110.0100.05414.78
7.3.100.0030.03814.62
7.3.90.0000.04115.00
7.3.80.0040.03214.91
7.3.70.0060.03514.97
7.3.60.0100.03314.91
7.3.50.0100.03014.94
7.3.40.0030.03514.84
7.3.30.0000.04014.80
7.3.20.0060.03916.33
7.3.10.0110.02916.32
7.3.00.0080.03116.38
7.2.250.0060.06214.91
7.2.240.0070.04715.17
7.2.230.0030.04015.17
7.2.220.0070.04214.76
7.2.210.0030.04414.83
7.2.200.0070.04315.13
7.2.190.0040.04215.14
7.2.180.0070.03715.00
7.2.170.0000.03914.83
7.2.130.0100.03616.26
7.2.120.0170.04416.55
7.2.110.0100.04416.88
7.2.100.0170.04616.42
7.2.90.0030.05316.36
7.2.80.0060.04816.72
7.2.70.0100.04416.54
7.2.60.0100.04316.48
7.2.50.0160.04016.40
7.2.40.0030.05116.78
7.2.30.0140.04416.54
7.2.20.0130.05316.55
7.2.10.0100.04716.87
7.2.00.0160.04116.86
7.1.330.0100.03415.85
7.1.320.0000.04315.62
7.1.310.0030.04215.54
7.1.300.0030.04815.76
7.1.290.0030.04615.67
7.1.280.0000.04215.58
7.1.270.0030.03815.76
7.1.260.0030.04315.54
7.1.250.0110.04015.63
7.1.70.0070.02317.19
7.1.60.0100.05419.70
7.1.50.0070.02316.99
7.1.00.0100.11022.30
7.0.200.0000.02816.52
7.0.140.0070.11021.96
7.0.70.0030.10721.76
7.0.60.0100.10021.80
7.0.50.0070.09722.18
7.0.40.0070.10720.13
7.0.30.0070.12020.14
7.0.20.0070.11020.01
7.0.10.0070.12020.06
7.0.00.0030.07019.92
5.6.280.0130.11721.33
5.6.220.0070.12020.96
5.6.210.0000.13320.77
5.6.200.0070.08321.35
5.6.190.0030.13021.32
5.6.180.0070.12321.30
5.6.170.0170.13021.34
5.6.160.0030.11321.23
5.6.150.0000.13321.33
5.6.140.0100.11321.29
5.6.130.0030.11721.35
5.6.120.0070.12721.32
5.6.110.0070.12721.30
5.6.100.0070.08321.31
5.6.90.0070.10721.27
5.6.80.0030.11320.74
5.6.70.0070.13720.71
5.6.60.0030.12720.75
5.6.50.0070.10320.68
5.6.40.0030.12720.68
5.6.30.0070.11020.70
5.6.20.0000.12720.75
5.6.10.0030.12720.68
5.6.00.0070.12320.67
5.5.360.0000.12720.70
5.5.350.0030.13320.66
5.5.340.0070.12321.05
5.5.330.0100.11721.10
5.5.320.0030.12021.16
5.5.310.0100.12721.13
5.5.300.0100.12721.15
5.5.290.0100.11021.22
5.5.280.0030.13021.20
5.5.270.0100.13321.20
5.5.260.0070.13321.12
5.5.250.0000.10320.73
5.5.240.0070.11720.52
5.5.230.0070.12020.47
5.5.220.0070.12720.50
5.5.210.0000.10320.39
5.5.200.0000.10320.55
5.5.190.0130.10320.36
5.5.180.0070.08320.39
5.5.160.0170.11720.45
5.5.150.0100.10720.28
5.5.140.0000.11320.43
5.5.130.0070.08320.53
5.5.120.0070.12320.47
5.5.110.0030.09720.43
5.5.100.0070.12020.36
5.5.90.0070.13320.43
5.5.80.0070.09320.40
5.5.70.0100.11720.27
5.5.60.0000.12320.41
5.5.50.0100.06020.27
5.5.40.0000.13020.31
5.5.30.0030.12320.34
5.5.20.0070.11320.40
5.5.10.0130.10720.27
5.5.00.0100.11320.39
5.4.450.0030.13019.58
5.4.440.0030.10719.51
5.4.430.0170.07319.58
5.4.420.0030.11019.54
5.4.410.0030.11319.60
5.4.400.0000.07019.26
5.4.390.0030.11719.26
5.4.380.0000.11719.13
5.4.370.0030.11019.32
5.4.360.0070.11719.40
5.4.350.0070.12319.25
5.4.340.0070.11319.24
5.4.320.0100.10719.33
5.4.310.0030.11719.27
5.4.300.0030.12019.07
5.4.290.0030.12019.40
5.4.280.0070.08319.21
5.4.270.0070.10719.25
5.4.260.0000.07019.25
5.4.250.0000.12319.31
5.4.240.0030.09719.24
5.4.230.0070.11719.24
5.4.220.0000.08019.42
5.4.210.0000.10319.27
5.4.200.0030.11319.46
5.4.190.0070.06019.16
5.4.180.0100.09319.06
5.4.170.0030.12019.25
5.4.160.0000.12319.32
5.4.150.0000.11719.15
5.4.140.0170.10716.64
5.4.130.0100.11016.52
5.4.120.0030.12716.61
5.4.110.0070.11316.65
5.4.100.0070.11716.77
5.4.90.0000.12016.77
5.4.80.0030.11716.55
5.4.70.0070.09016.80
5.4.60.0030.10016.57
5.4.50.0070.11716.49
5.4.40.0130.10016.66
5.4.30.0000.10716.52
5.4.20.0000.08316.55
5.4.10.0030.06716.53
5.4.00.0100.11016.20
5.3.290.0070.10315.04
5.3.280.0100.11314.99
5.3.270.0100.11314.98
5.3.260.0100.10715.02
5.3.250.0030.11714.89
5.3.240.0070.09015.02
5.3.230.0030.08014.90
5.3.220.0100.10314.86
5.3.210.0070.06714.90
5.3.200.0000.11314.93
5.3.190.0030.10714.89
5.3.180.0030.12014.85
5.3.170.0000.12314.77
5.3.160.0000.06314.90
5.3.150.0130.11014.76
5.3.140.0030.11014.89
5.3.130.0000.10314.79
5.3.120.0070.11314.84
5.3.110.0030.12014.81
5.3.100.0030.10014.26
5.3.90.0000.07314.24
5.3.80.0000.09714.39
5.3.70.0000.12314.32
5.3.60.0070.10314.33
5.3.50.0030.11014.29
5.3.40.0030.11014.27
5.3.30.0030.11314.15
5.3.20.0000.11314.07
5.3.10.0000.06714.03
5.3.00.0070.11314.01
5.2.170.0030.10312.20
5.2.160.0000.06012.20
5.2.150.0000.07012.20
5.2.140.0030.11012.20
5.2.130.0070.10312.20
5.2.120.0000.07312.20
5.2.110.0000.08012.20
5.2.100.0030.11012.20
5.2.90.0030.11312.20
5.2.80.0070.09712.20
5.2.70.0070.09712.20
5.2.60.0030.09712.20
5.2.50.0030.11012.20
5.2.40.0030.11012.20
5.2.30.0000.11012.20
5.2.20.0030.08012.20
5.2.10.0170.06712.20
5.2.00.0030.10012.20
5.1.60.0070.09012.20
5.1.50.0070.11312.20
5.1.40.0070.05712.20
5.1.30.0070.10312.20
5.1.20.0000.10712.20
5.1.10.0100.08312.20
5.1.00.0100.10012.20
5.0.50.0030.11312.20
5.0.40.0030.10012.20
5.0.30.0070.12712.20
5.0.20.0070.10712.20
5.0.10.0100.09012.20
5.0.00.0030.10712.20
4.4.90.0000.10312.20
4.4.80.0000.09012.20
4.4.70.0030.11012.20
4.4.60.0070.07712.20
4.4.50.0030.08712.20
4.4.40.0070.11712.20
4.4.30.0030.06012.20
4.4.20.0030.09712.20
4.4.10.0000.06712.20
4.4.00.0030.06712.20
4.3.110.0030.09712.20
4.3.100.0070.09012.20
4.3.90.0030.09312.20
4.3.80.0000.09312.20
4.3.70.0000.08012.20
4.3.60.0030.05312.20
4.3.50.0030.07012.20
4.3.40.0070.09712.20
4.3.30.0030.08312.20
4.3.20.0000.10312.20
4.3.10.0030.08312.20
4.3.00.0070.09712.20

preferences:
37.87 ms | 400 KiB | 5 Q