3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function getName(){ return 'name-foo';} public function getId(){ return 'id-foo';} } $objOtherClass = new Foo; $arr = []; $arr['school'] = 'school'; /* option 1 */ $valueAccess = true; $arr['name'] = 'test'; $arr['id'] = 1; if($valueAccess) { $arr['name'] = $objOtherClass->getName(); $arr['id'] = $objOtherClass->getId(); } /*option 2 */ $valueAccess = true; $name = 'test'; $id = 1; if($valueAccess) { $name = $objOtherClass->getName(); $id = $objOtherClass->getId(); } $arr['name'] = $name; $arr['id'] = $id;

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.4.140.0110.01120.32
8.4.130.0090.01017.85
8.4.120.0130.00720.79
8.4.110.0080.01222.53
8.4.100.0080.00317.45
8.4.90.0060.01118.61
8.4.80.0090.01217.86
8.4.70.0050.00317.63
8.4.60.0120.00818.59
8.4.50.0050.00620.38
8.4.40.0160.00317.50
8.4.30.0100.01018.46
8.4.20.0040.00718.82
8.4.10.0160.00317.45
8.3.270.0110.00816.70
8.3.260.0050.00516.52
8.3.250.0020.00818.52
8.3.240.0110.00716.37
8.3.230.0100.00916.52
8.3.220.0110.00517.09
8.3.210.0080.01018.29
8.3.200.0040.00416.33
8.3.190.0110.01016.93
8.3.180.0090.00616.49
8.3.170.0110.00717.03
8.3.160.0190.00016.57
8.3.150.0040.01116.84
8.3.140.0120.00617.05
8.3.130.0030.01518.46
8.3.120.0060.01020.71
8.3.110.0050.00520.94
8.3.100.0100.00624.06
8.3.90.0030.00526.77
8.3.80.0000.01017.97
8.3.70.0070.01418.43
8.3.60.0120.00318.41
8.3.50.0100.00618.00
8.3.40.0150.00018.84
8.3.30.0160.00018.89
8.3.20.0080.00019.05
8.3.10.0040.00423.67
8.3.00.0080.00022.52
8.2.290.0130.00520.46
8.2.280.0110.00618.41
8.2.270.0070.00017.30
8.2.260.0000.00918.49
8.2.250.0060.01216.48
8.2.240.0060.00316.94
8.2.230.0060.00322.58
8.2.220.0040.00837.54
8.2.210.0040.00426.77
8.2.200.0060.00316.75
8.2.190.0120.00316.58
8.2.180.0160.00618.29
8.2.170.0090.00622.96
8.2.160.0090.00620.92
8.2.150.0060.00924.18
8.2.140.0050.00324.66
8.2.130.0040.00422.03
8.2.120.0050.00326.35
8.2.110.0030.00621.00
8.2.100.0080.00418.09
8.2.90.0000.00918.34
8.2.80.0050.00317.97
8.2.70.0030.00617.68
8.2.60.0000.00818.16
8.2.50.0000.00818.10
8.2.40.0030.00520.97
8.2.30.0080.00020.67
8.2.20.0040.00417.98
8.2.10.0050.00317.95
8.2.00.0070.00019.44
8.1.330.0090.01023.52
8.1.320.0120.00616.25
8.1.310.0070.00718.56
8.1.300.0060.01317.61
8.1.290.0050.00530.84
8.1.280.0140.00725.92
8.1.270.0070.00722.01
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00321.98
8.1.230.0070.00422.75
8.1.220.0090.00017.74
8.1.210.0040.00718.77
8.1.200.0040.00417.36
8.1.190.0090.00017.22
8.1.180.0060.00618.10
8.1.170.0040.00418.78
8.1.160.0040.00418.82
8.1.150.0000.00818.79
8.1.140.0000.00818.92
8.1.130.0000.00819.07
8.1.120.0040.00417.28
8.1.110.0060.00317.29
8.1.100.0040.00417.40
8.1.90.0030.00517.34
8.1.80.0030.00317.32
8.1.70.0040.00417.28
8.1.60.0090.00017.51
8.1.50.0040.00417.55
8.1.40.0000.00817.42
8.1.30.0000.00817.52
8.1.20.0000.00717.58
8.1.10.0090.00017.38
8.1.00.0000.00817.37
8.0.300.0070.00019.56
8.0.290.0040.00416.75
8.0.280.0000.00718.40
8.0.270.0000.00717.20
8.0.260.0030.00318.45
8.0.250.0040.00416.87
8.0.240.0000.00716.81
8.0.230.0080.00316.78
8.0.220.0080.00016.72
8.0.210.0050.00316.88
8.0.200.0060.00316.87
8.0.190.0000.00816.96
8.0.180.0040.00416.83
8.0.170.0000.00916.83
8.0.160.0070.00016.73
8.0.150.0030.00516.60
8.0.140.0030.00316.82
8.0.130.0030.00313.23
8.0.120.0080.00016.77
8.0.110.0050.00216.66
8.0.100.0070.00016.84
8.0.90.0040.00416.70
8.0.80.0090.00916.88
8.0.70.0050.00216.75
8.0.60.0040.00316.68
8.0.50.0040.00416.76
8.0.30.0050.01317.07
8.0.20.0100.01417.40
8.0.10.0050.00216.95
8.0.00.0090.01116.78
7.4.330.0020.00215.55
7.4.320.0070.00016.59
7.4.300.0060.00016.59
7.4.290.0030.00316.61
7.4.280.0000.00716.56
7.4.270.0000.00716.61
7.4.260.0030.00716.45
7.4.250.0040.00416.45
7.4.240.0020.00516.59
7.4.230.0070.00016.59
7.4.220.0000.00816.63
7.4.210.0060.01016.69
7.4.200.0000.00716.53
7.4.160.0080.00816.52
7.4.140.0110.01017.86
7.4.130.0130.00316.50
7.4.120.0070.01116.45
7.4.110.0100.00716.41
7.4.100.0060.01616.61
7.4.90.0110.00816.31
7.4.80.0030.01419.39
7.4.70.0060.01016.40
7.4.60.0110.00816.38
7.4.50.0060.00916.32
7.4.40.0120.00816.26
7.4.00.0120.00314.98
7.3.330.0050.00013.29
7.3.320.0000.00613.32
7.3.310.0030.00316.38
7.3.300.0070.00016.32
7.3.290.0040.00416.34
7.3.280.0080.00616.30
7.3.260.0080.00916.42
7.3.240.0100.01116.40
7.3.230.0090.00916.55
7.3.210.0040.01416.63
7.3.200.0120.00916.45
7.3.190.0030.01216.69
7.3.180.0030.01316.45
7.3.170.0060.01116.30
7.3.160.0040.01316.61
7.2.330.0120.01116.27
7.2.320.0090.00916.54
7.2.310.0100.00716.71
7.2.300.0110.00716.45
7.2.290.0100.00716.53
7.2.90.0190.00514.68
7.2.80.3100.00314.35
7.2.70.4660.01314.73
7.2.60.3270.00914.65
7.2.50.3500.01314.29
7.2.40.0130.00814.48
7.2.30.1970.00314.83
7.2.20.2020.01014.47
7.2.10.1940.01714.37
7.2.00.2370.00314.70
7.1.210.4010.01313.36
7.1.200.2960.00313.67
7.1.190.3660.01313.95
7.1.180.2680.00713.52
7.1.170.2010.01013.58
7.1.160.0140.00413.48
7.1.150.2020.01013.62
7.1.140.2160.01013.56
7.1.130.1950.01013.57
7.1.120.1930.01013.77
7.1.110.3520.01013.54
7.1.100.3020.00313.85
7.1.90.3820.00713.74
7.1.80.0100.01113.47
7.1.70.0760.01013.81
7.1.60.0720.01831.56
7.1.50.0310.01831.66
7.1.40.0430.00931.81
7.1.30.0450.00631.61
7.1.20.1280.00731.64
7.1.10.0110.00813.44
7.1.00.2420.00613.48

preferences:
31.44 ms | 403 KiB | 5 Q