3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hallo() {} function hallo2() {} function simpleucall($n) { for ($i = 0; $i < $n; $i++) hallo(); } function simpleudcall($n) { for ($i = 0; $i < $n; $i++) hallo2(); } function simpleicall($n) { for ($i = 0; $i < $n; $i++) func_num_args(); } class Foo { static $a = 0; public $b = 0; const TEST = 0; static function read_static($n) { for ($i = 0; $i < $n; ++$i) $x = self::$a; } static function write_static($n) { for ($i = 0; $i < $n; ++$i) self::$a = 0; } static function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(self::$a); } static function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(self::$a); } static function f() {} static function call_static($n) { for ($i = 0; $i < $n; ++$i) self::f(); } function read_prop($n) { for ($i = 0; $i < $n; ++$i) $x = $this->b; } function write_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b = 0; } function assign_add_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b += 2; } function pre_inc_prop($n) { for ($i = 0; $i < $n; ++$i) ++$this->b; } function pre_dec_prop($n) { for ($i = 0; $i < $n; ++$i) --$this->b; } function post_inc_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b++; } function post_dec_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b--; } function isset_prop($n) { for ($i = 0; $i < $n; ++$i) $x = isset($this->b); } function empty_prop($n) { for ($i = 0; $i < $n; ++$i) $x = empty($this->b); } function g() {} function call($n) { for ($i = 0; $i < $n; ++$i) $this->g(); } function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = $this::TEST; } } function read_static($n){ for ($i = 0; $i < $n; ++$i) $x = Foo::$a; } function write_static($n) { for ($i = 0; $i < $n; ++$i) Foo::$a = 0; } function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(Foo::$a); } function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(Foo::$a); } function call_static($n) { for ($i = 0; $i < $n; ++$i) Foo::f(); } function create_object($n) { for ($i = 0; $i < $n; ++$i) $x = new Foo(); } define('TEST', null); function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = TEST; } function read_auto_global($n) { for ($i = 0; $i < $n; ++$i) $x = $_GET; } $g_var = 0; function read_global_var($n) { for ($i = 0; $i < $n; ++$i) $x = $GLOBALS['g_var']; } function read_hash($n) { $hash = array('test' => 0); for ($i = 0; $i < $n; ++$i) $x = $hash['test'];} function read_str_offset($n) { $str = "test"; for ($i = 0; $i < $n; ++$i) $x = $str[1]; } function issetor($n) { $val = array(0,1,2,3,4,5,6,7,8,9); for ($i = 0; $i < $n; ++$i) $x = $val ?: null; } function issetor2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ?: $j + 1; } function ternary($n) { $val = array(0,1,2,3,4,5,6,7,8,9); $f = false; for ($i = 0; $i < $n; ++$i) $x = $f ? null : $val; } function ternary2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ? $f : $j + 1; } /*****/ function getmicrotime() { $t = gettimeofday(); return ($t['sec'] + $t['usec'] / 1000000);} const N = 50000; simpleucall(N); simpleudcall(N); simpleicall(N); Foo::write_static(N); Foo::isset_static(N); Foo::empty_static(N); read_static(N); write_static(N); isset_static(N); empty_static(N); Foo::call_static(N); call_static(N); $x = new Foo(); $x->read_prop(N); $x->write_prop(N); $x->assign_add_prop(N); $x->pre_inc_prop(N); $x->pre_dec_prop(N); $x->post_inc_prop(N); $x->post_dec_prop(N); $x->isset_prop(N); $x->empty_prop(N); $x->call(N); $x->read_const(N); create_object(N); read_const(N); read_auto_global(N); read_global_var(N); read_hash(N); read_str_offset(N); issetor(N); issetor2(N); ternary(N); ternary2(N);

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.70.0130.04418.30
8.3.60.0130.02616.72
8.3.50.0240.03921.95
8.3.40.0100.03918.79
8.3.30.0060.04119.17
8.3.20.0090.01220.32
8.3.10.0030.01721.90
8.3.00.0060.01520.64
8.2.190.0070.04318.51
8.2.180.0130.02616.63
8.2.170.0100.02922.96
8.2.160.0070.03822.26
8.2.150.0040.01824.18
8.2.140.0070.01424.66
8.2.130.0030.01726.16
8.2.120.0110.01422.20
8.2.110.0040.03222.07
8.2.100.0130.01617.84
8.2.90.0100.01719.34
8.2.80.0040.02218.18
8.2.70.0000.02717.63
8.2.60.0000.02717.93
8.2.50.0000.02818.07
8.2.40.0030.02219.65
8.2.30.0040.02118.12
8.2.20.0030.02217.76
8.2.10.0030.02319.46
8.2.00.0030.02317.82
8.1.280.0030.03625.92
8.1.270.0040.01823.91
8.1.260.0070.01426.35
8.1.250.0030.01728.09
8.1.240.0070.02923.84
8.1.230.0100.01919.22
8.1.220.0060.01917.74
8.1.210.0100.01618.77
8.1.200.0030.02517.47
8.1.190.0000.02617.42
8.1.180.0030.02318.10
8.1.170.0040.02218.57
8.1.160.0060.02022.00
8.1.150.0000.02518.75
8.1.140.0040.02217.47
8.1.130.0060.01817.94
8.1.120.0060.01917.61
8.1.110.0070.02017.59
8.1.100.0000.02517.59
8.1.90.0040.02117.62
8.1.80.0000.02517.46
8.1.70.0070.01817.54
8.1.60.0030.03317.71
8.1.50.0060.02917.67
8.1.40.0000.03417.55
8.1.30.0000.03417.77
8.1.20.0070.02917.82
8.1.10.0000.03617.64
8.1.00.0030.03117.59
8.0.300.0000.02618.77
8.0.290.0000.02617.18
8.0.280.0070.02018.55
8.0.270.0000.02517.38
8.0.260.0000.02516.93
8.0.250.0030.02316.98
8.0.240.0030.02817.08
8.0.230.0030.02216.96
8.0.220.0000.02617.01
8.0.210.0040.02217.04
8.0.200.0040.02216.98
8.0.190.0030.03117.10
8.0.180.0030.03117.00
8.0.170.0000.03417.01
8.0.160.0030.03216.98
8.0.150.0070.02817.00
8.0.140.0060.02916.95
8.0.130.0030.03013.48
8.0.120.0030.03316.88
8.0.110.0030.03116.90
8.0.100.0030.03116.85
8.0.90.0030.03116.98
8.0.80.0110.04016.99
8.0.70.0030.03116.83
8.0.60.0000.03416.88
8.0.50.0070.03317.01
8.0.30.0080.04417.27
8.0.20.0110.04017.40
8.0.10.0000.03417.15
8.0.00.0070.04316.84
7.4.330.0000.02615.02
7.4.320.0030.02316.72
7.4.300.0000.02716.63
7.4.290.0000.03616.71
7.4.280.0030.03316.63
7.4.270.0090.02916.54
7.4.260.0000.03516.59
7.4.250.0070.03016.61
7.4.240.0070.03016.75
7.4.230.0070.02916.52
7.4.220.0070.05316.53
7.4.210.0120.04516.77
7.4.200.0040.03216.75
7.4.190.0000.03616.57
7.4.160.0130.04516.45
7.4.150.0120.04217.40
7.4.140.0120.04017.86
7.4.130.0110.05016.67
7.4.120.0070.04316.57
7.4.110.0100.04316.43
7.4.100.2450.05316.66
7.4.90.0060.06916.82
7.4.80.0090.04116.82
7.4.70.0110.04416.55
7.4.60.0130.03816.45
7.4.50.0000.05316.45
7.4.40.0070.03722.77
7.4.30.0120.03816.75
7.4.10.0030.05316.63
7.4.00.0100.04015.96
7.3.330.0030.03313.50
7.3.320.0000.03413.45
7.3.310.0000.03616.41
7.3.300.0070.03016.55
7.3.290.0100.05216.52
7.3.280.0090.05816.48
7.3.270.0100.04517.40
7.3.260.0100.04816.44
7.3.250.0140.05516.64
7.3.240.0160.05216.68
7.3.230.0060.04816.48
7.3.210.0090.04516.61
7.3.200.0090.05019.39
7.3.190.0120.06716.47
7.3.180.0090.04516.45
7.3.170.0160.03816.56
7.3.160.0160.04016.45
7.3.130.0160.03916.30
7.3.120.0050.05215.82
7.3.110.0030.04416.42
7.3.100.0100.04316.52
7.3.90.0070.04016.43
7.3.80.0030.04316.75
7.3.70.0070.03916.52
7.3.60.0030.04416.48
7.3.50.0060.04216.54
7.3.40.0100.03616.37
7.3.30.0070.03716.61
7.3.20.0070.04318.13
7.3.10.0070.05618.17
7.3.00.0100.03618.06
7.2.330.0130.04616.83
7.2.320.0170.06817.02
7.2.310.0100.04916.96
7.2.300.0060.05116.89
7.2.290.0170.05116.84
7.2.260.0100.04316.84
7.2.250.0100.04916.59
7.2.240.0100.04216.87
7.2.230.0070.06516.99
7.2.220.0070.06316.80
7.2.210.0000.04416.67
7.2.200.0070.05716.88
7.2.190.0030.05316.64
7.2.180.0030.05616.70
7.2.170.0060.04516.68
7.2.160.0070.05116.69
7.2.150.0100.03918.52
7.2.140.0100.05618.46
7.2.130.0100.04018.52
7.2.120.0030.05918.45
7.2.110.0030.05018.39
7.2.100.0120.04318.46
7.2.90.0060.05218.55
7.2.80.0130.03818.37
7.2.70.0030.05118.64
7.2.60.0060.03817.58
7.2.50.0000.04318.45
7.2.40.0030.04718.45
7.2.30.0070.04118.49
7.2.20.0070.04718.33
7.2.10.0070.04718.28
7.2.00.0000.04718.84
7.1.330.0030.09817.46
7.1.320.0100.09617.56
7.1.310.0030.10617.46
7.1.300.0100.08517.32
7.1.290.0070.08217.34
7.1.280.0030.10417.47
7.1.270.0030.09817.33
7.1.260.0070.08917.26
7.1.250.0030.10717.27
7.1.240.0100.11717.37
7.1.230.0030.09017.36
7.1.220.0000.09217.30
7.1.210.0070.08217.29
7.1.200.0080.06416.63
7.1.190.0100.08717.45
7.1.180.0070.09617.28
7.1.170.0000.09117.29
7.1.160.0070.09317.34
7.1.150.0030.09517.38
7.1.140.0000.08717.27
7.1.130.0070.09517.36
7.1.120.0100.08317.32
7.1.110.0030.08817.30
7.1.100.0020.06717.75
7.1.90.0030.09317.48
7.1.80.0030.09417.34
7.1.70.0050.07517.13
7.1.60.0050.07618.29
7.1.50.0080.06817.21
7.1.40.0000.12817.44
7.1.30.0030.09817.42
7.1.20.0000.09717.33
7.1.10.0130.08117.40
7.1.00.0070.10720.01
7.0.330.0030.12417.08
7.0.320.0070.09416.99
7.0.310.0030.12316.92
7.0.300.0070.08717.06
7.0.290.0000.12717.13
7.0.280.0070.09117.17
7.0.270.0070.09017.08
7.0.260.0070.09816.94
7.0.250.0000.09217.00
7.0.240.0030.09917.17
7.0.230.0100.09717.00
7.0.220.0070.09016.90
7.0.210.0100.08017.04
7.0.200.0050.06116.91
7.0.190.0100.08217.05
7.0.180.0100.09016.95
7.0.170.0070.08616.98
7.0.160.0000.09417.10
7.0.150.0100.08817.03
7.0.140.0070.10319.47
7.0.130.0070.08617.04
7.0.120.0070.09616.91
7.0.110.0030.09216.96
7.0.100.0030.11018.53
7.0.90.0150.10618.49
7.0.80.0020.09018.47
7.0.70.0180.11218.51
7.0.60.0030.10918.51
7.0.50.0120.10518.67
7.0.40.0080.11017.53
7.0.30.0050.10917.46
7.0.20.0030.11517.60
7.0.10.0080.09217.46
7.0.00.0050.11317.52
5.6.400.0070.22716.43
5.6.390.0130.22515.97
5.6.380.0030.24115.91
5.6.370.0070.20615.77
5.6.360.0000.22216.12
5.6.350.0030.22916.20
5.6.340.0030.20615.93
5.6.330.0070.21416.22
5.6.320.0160.20216.35
5.6.310.0070.21116.11
5.6.300.0070.21116.06
5.6.290.0030.24016.04
5.6.280.0020.20218.60
5.6.270.0070.22315.96
5.6.260.0070.19716.01
5.6.250.0120.20618.41
5.6.240.0000.18118.44
5.6.230.0130.16318.34
5.6.220.0050.18918.55
5.6.210.0050.19718.46
5.6.200.0070.17818.57
5.6.190.0050.20318.56
5.6.180.0030.19418.52
5.6.170.0070.19218.49
5.6.160.0100.20018.46
5.6.150.0020.19818.78
5.6.140.0020.19018.59
5.6.130.0050.17918.59
5.6.120.0070.16818.63
5.6.110.0100.18418.57
5.6.100.0030.18718.62
5.6.90.0070.20118.63
5.6.80.0050.19518.28
5.6.70.0080.19318.24
5.6.60.0030.19018.15
5.6.50.0020.17618.26
5.6.40.0100.19118.09
5.6.30.0050.19918.21
5.6.20.0020.16818.21
5.6.10.0030.19618.27
5.6.00.0030.17518.13
5.5.380.0070.19218.38
5.5.370.0050.20418.26
5.5.360.0050.19618.29
5.5.350.0080.19718.30
5.5.340.0050.20718.62
5.5.330.0070.17818.32
5.5.320.0080.19218.57
5.5.310.0050.19218.41
5.5.300.0130.16218.41
5.5.290.0050.19118.55
5.5.280.0100.18618.40
5.5.270.0070.18318.42
5.5.260.0100.20018.44
5.5.250.0030.19818.35
5.5.240.0070.19318.12
5.5.230.0080.19518.13
5.5.220.0070.18718.01
5.5.210.0030.15918.16
5.5.200.0070.16418.08
5.5.190.0080.20518.05
5.5.180.0050.21118.21
5.5.170.0030.23916.09
5.5.160.0150.17918.08
5.5.150.0070.18518.11
5.5.140.0070.19718.06
5.5.130.0080.19618.00
5.5.120.0130.17218.10
5.5.110.0070.15418.14
5.5.100.0070.20118.11
5.5.90.0030.17818.16
5.5.80.0030.18018.01
5.5.70.0030.20818.00
5.5.60.0100.19118.09
5.5.50.0030.20017.97
5.5.40.0050.19718.02
5.5.30.0080.21018.04
5.5.20.0100.17318.12
5.5.10.0100.19618.03
5.5.00.0080.19817.97
5.4.450.0030.19916.25
5.4.440.0050.18216.21
5.4.430.0070.19616.07
5.4.420.0050.21416.06
5.4.410.0080.20916.00
5.4.400.0020.20215.91
5.4.390.0030.21116.06
5.4.380.0070.19515.92
5.4.370.0050.19415.74
5.4.360.0030.20115.79
5.4.350.0080.19516.00
5.4.340.0030.21815.75
5.4.330.0000.24512.58
5.4.320.0050.17915.97
5.4.310.0070.19815.98
5.4.300.0070.19215.89
5.4.290.0050.19415.99
5.4.280.0050.19415.73
5.4.270.0070.20715.76
5.4.260.0080.18215.83
5.4.250.0030.19616.00
5.4.240.0070.16115.75
5.4.230.0070.15715.88
5.4.220.0050.18415.75
5.4.210.0050.17616.03
5.4.200.0030.20215.93
5.4.190.0070.20715.87
5.4.180.0070.17015.92
5.4.170.0030.20115.92
5.4.160.0080.18915.80
5.4.150.0070.18915.79
5.4.140.0070.19914.46
5.4.130.0050.20914.46
5.4.120.0050.19614.67
5.4.110.0070.18914.59
5.4.100.0030.18814.72
5.4.90.0080.16914.64
5.4.80.0050.17014.70
5.4.70.0070.21414.63
5.4.60.0030.20114.55
5.4.50.0070.18614.61
5.4.40.0050.19414.54
5.4.30.0050.18714.70
5.4.20.0070.19314.63
5.4.10.0050.18014.62
5.4.00.0000.18914.29
5.3.290.0080.23114.03
5.3.280.0050.29113.98
5.3.270.0050.29914.00
5.3.260.0070.29014.05
5.3.250.0070.32113.94
5.3.240.0050.29113.92
5.3.230.0030.30413.98
5.3.220.0050.32813.90
5.3.210.0050.33113.92
5.3.200.0070.31113.88
5.3.190.0070.33613.80
5.3.180.0050.27314.02
5.3.170.0070.29414.04
5.3.160.0050.30814.03
5.3.150.0070.26814.01
5.3.140.0070.30513.96
5.3.130.0020.31213.89
5.3.120.0030.27713.86
5.3.110.0100.34213.87
5.3.100.0070.27813.65
5.3.90.0030.34113.70
5.3.80.0070.33613.55
5.3.70.0050.33113.65
5.3.60.0000.30913.67
5.3.50.0030.34513.73
5.3.40.0070.34113.58
5.3.30.0030.29313.64
5.3.20.0050.29613.45
5.3.10.0070.26313.41
5.3.00.0050.28513.22

preferences:
34.92 ms | 401 KiB | 5 Q