3v4l.org

run code in 300+ PHP versions simultaneously
<?php class WebASM { private $_input; private $_val; private $_0 = 0; private $_1 = 0; private $_2 = 0; private $_3 = 0; private $_4 = 0; private $_5 = 0; private $_6 = 0; private $_7 = 0; public function __construct($code) { $this->_0 = $code; unset($code); if(!is_string($this->_0)) { $this->_0 = 0; return 1; } if(preg_match('#^file\:#', $this->_0)) { $this->_0 = preg_replace('#^file\:#', '', $this->_0); if(file_exists($this->_0)) { $this->_0 = file_get_contents($this->_0); } else { $this->_0 = 0; return 1; } } $this->_0 = preg_replace_callback('#(.*):#', function ($matches) { if(is_numeric($matches[1])) { return 'a'.$matches[0]; } else { return '//'.$matches[0]; } }, $this->_0); $this->_0 = preg_replace('#pri?nt (.*)#', 'echo(\$this->_$1);', $this->_0); $this->_0 = preg_replace('#set ([0-7]) ([0-9]{1,256})#U', '\$this->_$1 = $2;', $this->_0); $this->_0 = preg_replace('#copyto ([0-7])#', '\$this->_$1 = \$this->_val;', $this->_0); $this->_0 = preg_replace('#copyfrom ([0-7])#', '\$this->_val = \$this->_$1;', $this->_0); //$this->_0 = preg_replace('#pro?mpt (str|int) ([0-9]{256})#', 'echo($1);', $this->_0); $this->_0 = preg_replace('#add ([0-7])#', '\$this->_val = \$this->_val + \$this->_$1;', $this->_0); $this->_0 = preg_replace('#sub ([0-7])#', '\$this->_val = \$this->_val - \$this->_$1;', $this->_0); $this->_0 = preg_replace('#jump ([0-9]{1,256}) if ([0-7]) ([0-9]{1,256})#', 'if(\$this->_$2 == $3) goto a$1;', $this->_0); $this->_0 = preg_replace('#jump ([0-9]{1,256}) if ([0-9]{1,256})#', 'if(\$this->_val == $2) goto a$1;', $this->_0); $this->_0 = preg_replace('#jump ([0-9]{1,256})#', 'goto a$1;', $this->_0); $this->_0 = preg_replace('#(die|re?tu?rn|exit)#', 'return 0;', $this->_0); $this->_0 = '$c = function () {'.$this->_0.'return 1;};$x=$c();if($x!=0)echo("An error has occured.");'; eval($this->_0); } } $code = <<<WebASM set 0 1 set 1 1 copyfrom 0 0: add 1 jump 1 if 3 jump 0 1: copyto 0 print 0 lol: print 1 WebASM; $asm = new WebASM($code);

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.0090.00616.75
8.3.50.0110.00822.11
8.3.40.0070.01418.89
8.3.30.0070.00718.92
8.3.20.0040.00420.20
8.3.10.0050.00323.68
8.3.00.0080.00019.63
8.2.180.0060.01217.00
8.2.170.0040.01422.96
8.2.160.0070.00720.70
8.2.150.0000.00925.66
8.2.140.0040.00424.66
8.2.130.0030.00617.63
8.2.120.0000.00826.35
8.2.110.0040.00821.11
8.2.100.0070.00418.22
8.2.90.0080.00018.22
8.2.80.0060.00318.00
8.2.70.0050.00517.88
8.2.60.0000.00818.16
8.2.50.0040.00418.07
8.2.40.0050.00318.26
8.2.30.0040.00418.23
8.2.20.0070.00317.97
8.2.10.0050.00318.23
8.2.00.0040.00418.13
8.1.280.0050.01025.92
8.1.270.0080.00023.91
8.1.260.0030.00628.09
8.1.250.0040.00428.09
8.1.240.0080.00322.61
8.1.230.0080.00420.87
8.1.220.0000.00817.79
8.1.210.0030.00618.98
8.1.200.0090.00017.48
8.1.190.0060.00317.48
8.1.180.0060.00318.10
8.1.170.0080.00018.72
8.1.160.0080.00018.86
8.1.150.0040.00418.84
8.1.140.0050.00519.63
8.1.130.0040.00417.79
8.1.120.0070.00017.67
8.1.110.0030.00617.68
8.1.100.0030.00517.65
8.1.90.0080.00017.65
8.1.80.0040.00417.66
8.1.70.0040.00417.63
8.1.60.0000.00817.80
8.1.50.0040.00417.78
8.1.40.0000.00817.73
8.1.30.0000.00917.71
8.1.20.0050.00517.86
8.1.10.0000.00917.79
8.1.00.0000.00817.61
8.0.300.0000.00720.03
8.0.290.0040.00417.00
8.0.280.0000.00718.55
8.0.270.0050.00317.30
8.0.260.0030.00317.35
8.0.250.0040.00417.30
8.0.240.0040.00417.11
8.0.230.0070.00017.20
8.0.220.0030.00717.03
8.0.210.0040.00417.14
8.0.200.0000.00717.12
8.0.190.0030.00517.23
8.0.180.0080.00017.08
8.0.170.0050.00317.26
8.0.160.0040.00417.14
8.0.150.0060.00417.11
8.0.140.0000.00716.95
8.0.130.0000.00713.66
8.0.120.0040.00417.11
8.0.110.0050.00517.19
8.0.100.0040.00416.99
8.0.90.0070.00017.00
8.0.80.0060.01217.12
8.0.70.0050.00216.96
8.0.60.0040.00417.12
8.0.50.0050.00317.16
8.0.30.0110.00617.32
8.0.20.0110.00817.43
8.0.10.0040.00417.30
8.0.00.0070.01017.13
7.4.330.0000.00516.77
7.4.320.0000.00716.78
7.4.300.0040.00416.88
7.4.290.0000.00716.86
7.4.280.0040.00416.92
7.4.270.0000.00816.80
7.4.260.0000.00716.63
7.4.250.0030.00516.87
7.4.240.0060.00216.84
7.4.230.0000.00716.86
7.4.220.0100.01016.82
7.4.210.0080.00816.89
7.4.200.0040.00416.77
7.4.160.0100.01016.89
7.4.150.0090.00917.40
7.4.140.0130.00517.86
7.4.130.0080.01016.78
7.4.120.0100.00816.82
7.4.110.0090.01016.64
7.4.100.0040.01416.96
7.4.90.0070.01016.75
7.4.80.0090.00919.39
7.4.70.0120.00616.75
7.4.60.0100.00717.00
7.4.50.0040.00816.68
7.4.40.0110.00616.76
7.4.30.0120.00616.89
7.4.00.0040.00815.27
7.3.330.0000.00613.47
7.3.320.0060.00013.62
7.3.310.0050.00216.70
7.3.300.0040.00416.66
7.3.290.0110.00516.60
7.3.280.0110.00716.58
7.3.270.0080.01217.40
7.3.260.0170.00016.85
7.3.250.0080.01216.76
7.3.240.0110.01016.71
7.3.230.0070.01016.64
7.3.210.0070.01016.83
7.3.200.0120.00416.74
7.3.190.0140.00716.95
7.3.180.0210.00016.59
7.3.170.0150.00316.57
7.3.160.0030.01416.73
7.2.330.0120.00416.89
7.2.320.0090.01516.79
7.2.310.0140.00316.84
7.2.300.0090.00916.95
7.2.290.0090.01617.06
7.2.00.0030.01719.82
7.1.100.0030.01318.37
7.1.70.0000.00817.31
7.1.60.0100.01619.36
7.1.50.0040.01117.36
7.1.00.0030.07322.47
7.0.200.0000.00817.10
7.0.60.0070.03720.09
7.0.50.0070.03718.01
7.0.40.0030.09320.33
7.0.30.0270.05720.11
7.0.20.0370.05720.12
7.0.10.0130.07720.22
7.0.00.0100.04720.15
5.6.280.0000.04721.07
5.6.210.0130.03020.56
5.6.200.0070.04318.32
5.6.190.0100.07320.61
5.6.180.0170.05020.55
5.6.170.0270.07020.71
5.6.160.0130.08320.39
5.6.150.0100.07018.18
5.6.140.0200.06718.23
5.6.130.0030.08318.27
5.6.120.0030.04721.15
5.6.110.0170.08021.14
5.6.100.0200.04721.02
5.6.90.0170.06321.06
5.6.80.0030.08720.57
5.5.350.0130.08320.32
5.5.340.0130.04018.05
5.5.330.0030.06320.41
5.5.320.0230.07720.36
5.5.310.0330.06020.29
5.5.300.0030.08718.02
5.5.290.0100.05717.99
5.5.280.0130.05320.96
5.5.270.0070.08720.90
5.5.260.0100.06321.00
5.5.250.0100.06720.81
5.5.240.0370.06320.21

preferences:
43.49 ms | 401 KiB | 5 Q