3v4l.org

run code in 300+ PHP versions simultaneously
<?php function x($o) { return get_object_vars($o);} class A { public $a; public $b; private $c; protected static $columnRegistry = array(); protected $columns = array(); public function __construct($a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; $this->setupColumns(); } public function toArray() { $ret = []; foreach ($this->columns as $column) { $ret[$column] = $this->$column; } return $ret; } protected function setupColumns() { $class = get_class($this); // Define columns for current row if (!array_key_exists($class, self::$columnRegistry)) { $this->columns = array_keys(x($this)); self::$columnRegistry[$class] = $this->columns; } else { $this->columns = self::$columnRegistry[$class]; } } } $expected = [ 'a' => 1, 'b' => 2, ]; $numReps = 100000; for($i = 0; $i < $numReps; $i++) { $o = new A(1, 2, 3); $res = $o->toArray(); if ($res !== $expected) { throw new Exception("Not same"); } } echo "OK";

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.0190.05816.63
8.3.50.0080.05221.92
8.3.40.0100.04318.79
8.3.30.0000.05519.12
8.3.20.0070.02320.38
8.3.10.0000.03021.91
8.3.00.0000.03117.80
8.2.180.0200.04316.63
8.2.170.0070.04722.96
8.2.160.0030.04920.52
8.2.150.0060.02224.18
8.2.140.0090.01924.66
8.2.130.0060.02626.16
8.2.120.0030.02621.16
8.2.110.0030.04222.29
8.2.100.0000.04819.88
8.2.90.0070.03919.30
8.2.80.0070.03917.97
8.2.70.0070.03817.63
8.2.60.0030.04618.04
8.2.50.0030.04318.07
8.2.40.0100.03319.77
8.2.30.0030.04818.18
8.2.20.0030.04717.63
8.2.10.0070.03918.14
8.2.00.0060.03817.73
8.1.280.0100.05925.92
8.1.270.0070.02421.98
8.1.260.0000.02826.35
8.1.250.0090.01928.09
8.1.240.0100.03723.71
8.1.230.0090.03419.16
8.1.220.0030.04017.74
8.1.210.0030.04118.77
8.1.200.0000.04417.35
8.1.190.0100.03517.22
8.1.180.0030.03918.10
8.1.170.0070.03618.49
8.1.160.0030.03821.93
8.1.150.0030.03918.89
8.1.140.0030.04117.36
8.1.130.0030.03817.71
8.1.120.0030.04017.54
8.1.110.0070.03817.43
8.1.100.0030.04217.37
8.1.90.0060.03817.43
8.1.80.0030.03817.50
8.1.70.0030.03917.39
8.1.60.0000.04617.61
8.1.50.0030.04217.57
8.1.40.0100.04617.58
8.1.30.0070.03917.71
8.1.20.0030.04217.57
8.1.10.0030.04317.45
8.1.00.0070.04017.37
8.0.300.0030.03718.77
8.0.290.0030.04016.59
8.0.280.0030.04118.33
8.0.270.0070.03717.25
8.0.260.0030.04317.28
8.0.250.0030.04116.95
8.0.240.0070.03816.92
8.0.230.0000.04717.00
8.0.220.0030.04516.91
8.0.210.0000.04716.96
8.0.200.0030.04216.85
8.0.190.0060.03816.98
8.0.180.0000.04516.90
8.0.170.0000.04616.96
8.0.160.0070.03916.86
8.0.150.0030.04216.97
8.0.140.0070.05016.80
8.0.130.0060.03813.30
8.0.120.0030.04316.85
8.0.110.0030.04216.82
8.0.100.0000.04716.71
8.0.90.0070.04016.91
8.0.80.0100.06516.79
8.0.70.0030.04116.77
8.0.60.0030.04316.77
8.0.50.0030.04316.82
8.0.30.0140.05817.25
8.0.20.0120.06717.40
8.0.10.0030.04216.83
8.0.00.0130.06916.86
7.4.330.0030.04115.00
7.4.320.0000.04516.62
7.4.300.0000.04716.42
7.4.290.0030.04316.52
7.4.280.0000.05016.61
7.4.270.0000.04716.50
7.4.260.0060.04116.58
7.4.250.0070.05016.47
7.4.240.0030.04516.59
7.4.230.0000.04816.46
7.4.220.0030.07716.55
7.4.210.0060.10516.63
7.4.200.0070.04016.64
7.4.160.0140.07516.51
7.4.150.0070.07217.40
7.4.140.0080.07917.86
7.4.130.0120.07016.50
7.4.120.0130.07116.56
7.4.110.0060.10016.40
7.4.100.0100.07116.50
7.4.90.0100.07216.63
7.4.80.0100.10619.39
7.4.70.0070.06516.33
7.4.60.0200.06616.53
7.4.50.0060.05216.20
7.4.40.0130.06116.59
7.4.30.0060.06616.37
7.4.00.0030.10114.84
7.3.330.0000.05513.44
7.3.320.0030.04513.17
7.3.310.0000.05016.47
7.3.300.0000.04716.32
7.3.290.0070.06216.35
7.3.280.0090.10616.38
7.3.270.0130.06217.40
7.3.260.0070.09316.50
7.3.250.0100.08716.36
7.3.240.0190.05916.38
7.3.230.0070.08016.39
7.3.210.0090.10016.62
7.3.200.0100.07119.39
7.3.190.0160.12916.62
7.3.180.0070.06716.21
7.3.170.0060.06916.54
7.3.160.0190.09816.63
7.3.120.0080.09114.89
7.3.110.0030.11514.81
7.3.100.0050.08515.00
7.3.90.0000.09414.98
7.3.80.0070.07014.77
7.3.70.0030.07514.75
7.3.60.0030.09414.80
7.3.50.0070.07014.78
7.3.40.0020.07914.66
7.3.30.0020.07814.90
7.3.20.0030.07816.71
7.3.10.0070.08216.65
7.3.00.0030.08216.85
7.2.330.0100.07516.75
7.2.320.0070.07616.82
7.2.310.0100.07216.94
7.2.300.0130.06616.80
7.2.290.0160.07116.58
7.2.250.0050.10915.06
7.2.240.0080.10515.23
7.2.230.0030.09515.13
7.2.220.0030.10514.95
7.2.210.0030.08115.18
7.2.200.0020.09115.07
7.2.190.0020.08715.12
7.2.180.0080.09715.17
7.2.170.0050.07815.16
7.2.160.0030.08115.10
7.2.150.0030.08116.84
7.2.140.0030.07816.91
7.2.130.0100.08116.84
7.2.120.0070.08117.08
7.2.110.0030.10817.01
7.2.100.0000.09116.89
7.2.90.0070.08416.85
7.2.80.0030.10217.02
7.2.70.0030.07717.02
7.2.60.0030.08517.00
7.2.50.0000.08617.08
7.2.40.0070.07917.03
7.2.30.0070.07616.88
7.2.20.0030.07917.04
7.2.10.0100.09216.96
7.2.00.0070.06518.14
7.1.330.0030.12215.95
7.1.320.0050.12515.87
7.1.310.0050.12615.68
7.1.300.0050.13715.73
7.1.290.0070.13115.61
7.1.280.0070.12715.81
7.1.270.0050.13215.60
7.1.260.0080.12415.81
7.1.250.0030.12115.98
7.1.100.0100.06018.24
7.1.70.0030.05317.14
7.1.60.0070.10419.25
7.1.50.0070.09717.05
7.1.00.0030.16322.36
7.0.200.0030.09116.69
7.0.140.0070.15021.93
7.0.60.0030.12019.98
7.0.50.0170.12717.92
7.0.40.0070.19720.02
7.0.30.0200.10020.06
7.0.20.0270.08320.19
7.0.10.0030.09020.07
7.0.00.0130.11720.10
5.6.280.0100.25720.90
5.6.210.0070.22320.48
5.6.200.0030.26718.15
5.6.190.0130.20720.52
5.6.180.0230.16720.55
5.6.170.0200.17320.44
5.6.160.0030.17320.54
5.6.150.0000.16318.18
5.6.140.0100.16318.14
5.6.130.0030.19318.18
5.6.120.0030.20721.03
5.6.110.0100.23020.98
5.6.100.0070.22321.03
5.6.90.0030.18021.02
5.6.80.0070.15720.52
5.5.350.0230.20720.50
5.5.340.0130.22718.01
5.5.330.0030.24320.47
5.5.320.0170.18020.35
5.5.310.0370.19320.35
5.5.300.0000.19717.99
5.5.290.0000.23718.08
5.5.280.0070.17020.78
5.5.270.0070.24020.74
5.5.260.0070.22020.88
5.5.250.0100.22320.70
5.5.240.0100.21020.27
5.4.450.0730.34319.59
5.4.440.0700.32019.47
5.4.430.0800.30319.55
5.4.420.0970.30719.63
5.4.410.0130.30719.04
5.4.400.0370.29018.82
5.4.390.0270.34018.58
5.4.380.0230.33318.59
5.4.370.0070.41018.75
5.4.360.0100.34718.81
5.4.350.0090.46012.03
5.4.340.0090.23612.02
5.4.320.0100.22712.52
5.4.310.0050.24212.51
5.4.300.0050.25112.52
5.4.290.0050.22712.51
5.4.280.0100.23212.41
5.4.270.0050.24312.41
5.4.260.0040.24912.41
5.4.250.0070.24512.41
5.4.240.0040.25712.41
5.4.230.0060.23612.41
5.4.220.0050.22912.40
5.4.210.0070.23212.40
5.4.200.0060.23512.40
5.4.190.0040.24912.40
5.4.180.0060.32112.39
5.4.170.0060.23712.41
5.4.160.0050.23112.40
5.4.150.0080.22712.40
5.4.140.0050.23812.08
5.4.130.0060.24012.07
5.4.120.0080.30412.03
5.4.110.0060.29012.03
5.4.100.0080.30112.02
5.4.90.0130.28912.02
5.4.80.0060.28312.02
5.4.70.0080.25212.02
5.4.60.0050.36712.02
5.4.50.0050.26412.02
5.4.40.0060.22812.01
5.4.30.0070.25512.00
5.4.20.0050.25112.00
5.4.10.0040.27812.00
5.4.00.0060.24511.49
5.3.290.0050.03912.80
5.3.280.0050.04012.71
5.3.270.0050.04012.72
5.3.260.0080.03712.72
5.3.250.0070.03612.72
5.3.240.0060.03912.72
5.3.230.0030.04212.71
5.3.220.0050.03912.68
5.3.210.0060.03812.68
5.3.200.0070.04812.68
5.3.190.0030.04412.68
5.3.180.0060.03612.67
5.3.170.0110.04512.67
5.3.160.0070.03712.68
5.3.150.0050.04112.67
5.3.140.0040.04012.66
5.3.130.0050.04112.66
5.3.120.0070.03912.66
5.3.110.0060.04012.66
5.3.100.0030.04012.13
5.3.90.0060.03712.11
5.3.80.0050.03712.10
5.3.70.0050.03712.10
5.3.60.0040.03912.09
5.3.50.0050.03912.04
5.3.40.0050.03812.04
5.3.30.0050.03712.01
5.3.20.0050.03611.78
5.3.10.0070.03411.75
5.3.00.0040.04411.72
5.2.170.0060.0379.23
5.2.160.0060.0289.23
5.2.150.0040.0329.23
5.2.140.0040.0349.22
5.2.130.0050.0409.19
5.2.120.0080.0399.19
5.2.110.0100.0449.19
5.2.100.0070.0379.19
5.2.90.0090.0369.19
5.2.80.0070.0399.18
5.2.70.0090.0369.18
5.2.60.0100.0369.14
5.2.50.0090.0559.11
5.2.40.0030.0419.08
5.2.30.0060.0419.06
5.2.20.0070.0349.05
5.2.10.0130.0418.95
5.2.00.0070.0528.82
5.1.60.0100.0468.10
5.1.50.0070.0348.09
5.1.40.0140.0288.07
5.1.30.0070.0338.43
5.1.20.0060.0398.45
5.1.10.0030.0288.17
5.1.00.0040.0288.18
5.0.50.0070.0246.65
5.0.40.0030.0286.52
5.0.30.0040.0326.32
5.0.20.0050.0196.29
5.0.10.0030.0266.27
5.0.00.0030.0336.27
4.4.90.0040.0164.78
4.4.80.0030.0154.76
4.4.70.0000.0194.76
4.4.60.0020.0164.75
4.4.50.0030.0174.77
4.4.40.0020.0304.71
4.4.30.0020.0164.76
4.4.20.0050.0174.84
4.4.10.0010.0174.84
4.4.00.0030.0264.76
4.3.110.0050.0154.66
4.3.100.0050.0134.67
4.3.90.0030.0174.64
4.3.80.0020.0304.58
4.3.70.0030.0174.63
4.3.60.0020.0184.63
4.3.50.0030.0184.63
4.3.40.0030.0254.54
4.3.30.0040.0203.30
4.3.20.0030.0163.29
4.3.10.0020.0163.24
4.3.00.0100.0277.13

preferences:
35.31 ms | 401 KiB | 5 Q