3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileData = '$orange="100kg";$Apple="400kg";$Peach="543kg";'; $patternVars = '/(?<=\$).*?(?=\=)/m'; $patternValues = '/(?<="(?!;)).*?(?=")/m'; $vars = preg_match_all($patternVars, $fileData, $varMatches); // Match all variables $values = preg_match_all($patternValues, $fileData, $valueMatches); // Match all values forEach($varMatches[0] as $key => $value){ // Use the value to name your variable (hence the weird looking "$$") and set the value of this variable to the matches of your values. $$value = $valueMatches[0][$key]; } var_dump($orange); // Will output "100kg"

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.5.30.0100.00820.27
8.5.20.0130.00620.13
8.5.10.0070.01218.76
8.5.00.0090.01220.00
8.4.180.0130.01019.87
8.4.170.0140.00821.87
8.4.160.0160.00722.04
8.4.150.0050.00716.92
8.4.140.0110.01117.52
8.4.130.0130.00718.66
8.4.120.0150.00718.05
8.4.110.0140.00718.11
8.4.100.0110.00617.94
8.4.90.0130.00820.72
8.4.80.0120.00520.90
8.4.70.0120.00918.76
8.4.60.0060.00420.54
8.4.50.0090.01220.45
8.4.40.0040.00817.94
8.4.30.0130.00620.64
8.4.20.0060.00318.03
8.4.10.0130.00319.79
8.3.300.0100.01020.30
8.3.290.0110.00920.75
8.3.280.0160.00618.56
8.3.270.0110.01016.81
8.3.260.0100.00916.52
8.3.250.0120.00816.78
8.3.240.0110.00818.50
8.3.230.0110.00916.90
8.3.220.0060.01218.83
8.3.210.0090.01018.40
8.3.200.0080.00316.56
8.3.190.0050.00517.15
8.3.180.0100.00719.13
8.3.170.0090.01017.08
8.3.160.0090.00917.29
8.3.150.0190.00016.77
8.3.140.0140.00416.60
8.3.130.0100.01016.91
8.3.120.0090.00020.64
8.3.110.0030.00616.91
8.3.100.0060.00318.39
8.3.90.0140.00426.77
8.3.80.0060.00318.53
8.3.70.0120.00316.88
8.3.60.0100.01316.75
8.3.50.0070.01120.04
8.3.40.0150.00618.94
8.3.30.0110.00418.75
8.3.20.0040.00424.18
8.3.10.0150.00424.66
8.3.00.0000.00826.16
8.2.300.0120.00922.13
8.2.290.0120.01017.03
8.2.280.0080.01120.25
8.2.270.0120.00616.64
8.2.260.0030.00617.12
8.2.250.0000.01016.74
8.2.240.0030.00618.98
8.2.230.0040.00820.94
8.2.220.0040.00424.06
8.2.210.0030.00626.77
8.2.200.0030.00616.88
8.2.190.0150.00616.62
8.2.180.0120.00325.92
8.2.170.0120.00319.21
8.2.160.0070.00722.96
8.2.150.0070.00025.66
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0030.00717.93
8.2.110.0070.00322.24
8.2.100.0030.00917.97
8.2.90.0000.00818.00
8.2.80.0030.00519.05
8.2.70.0030.00517.75
8.2.60.0030.00517.88
8.2.50.0030.00617.75
8.2.40.0040.00418.34
8.2.30.0050.00218.04
8.2.20.0000.00720.48
8.2.10.0040.00417.87
8.2.00.0000.00719.43
8.1.340.0140.00523.58
8.1.330.0100.00816.50
8.1.320.0100.00918.03
8.1.310.0070.01017.05
8.1.300.0090.00920.03
8.1.290.0000.01030.84
8.1.280.0070.00725.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00320.89
8.1.230.0110.00017.77
8.1.220.0040.00417.89
8.1.210.0030.00518.77
8.1.200.0100.00017.47
8.1.190.0060.00317.48
8.1.180.0000.00818.10
8.1.170.0040.00417.65
8.1.160.0000.00718.88
8.1.150.0090.00318.70
8.1.140.0000.00717.48
8.1.130.0000.00818.90
8.1.120.0070.00017.46
8.1.110.0030.00617.51
8.1.100.0000.00817.61
8.1.90.0050.00317.56
8.1.80.0000.00717.57
8.1.70.0000.00717.53
8.1.60.0040.00417.73
8.1.50.0060.00317.56
8.1.40.0080.00017.68
8.1.30.0030.00517.78
8.1.20.0160.00617.70
8.1.10.0200.00717.70
8.1.00.0190.00717.59
8.0.300.0040.00418.77
8.0.290.0000.00816.88
8.0.280.0070.00018.38
8.0.270.0000.00716.96
8.0.260.0030.00318.51
8.0.250.0040.00416.98
8.0.240.0070.00016.98
8.0.230.0050.00317.05
8.0.220.0030.00317.03
8.0.210.0030.00316.92
8.0.200.0060.00016.98
8.0.190.0040.00417.11
8.0.180.0040.00416.99
8.0.170.0000.00917.04
8.0.160.0040.00417.02
8.0.150.0190.00416.94
8.0.140.0210.00216.96
8.0.130.0160.00616.91
8.0.120.0180.00416.91
8.0.110.0160.00516.98
8.0.100.0160.00616.95
8.0.90.0170.00417.01
8.0.80.0180.00316.98
8.0.70.0200.00316.97
8.0.60.0130.00917.00
8.0.50.0170.00316.92
8.0.30.0150.00416.95
8.0.20.0170.00317.00
8.0.10.0160.00517.12
7.4.330.0000.00615.55
7.4.320.0030.00316.72
7.4.300.0030.00316.83
7.4.290.0030.00316.65
7.4.280.0080.00016.81
7.4.270.0130.00616.76
7.4.260.0170.00316.77
7.4.250.0160.00916.75
7.4.240.0120.00516.68
7.4.230.0150.00516.75
7.4.220.0140.00516.67
7.4.210.0130.00816.70
7.4.200.0140.00516.79
7.4.190.0120.00616.81
7.4.180.0150.00416.69
7.4.160.0140.00516.77
7.4.150.0120.00816.74
7.4.140.0170.00316.64
7.4.130.0160.00416.73
7.4.120.0150.00516.67
7.4.110.0170.00416.69
7.4.100.0130.00516.75
7.4.90.0150.00416.70
7.4.80.0110.00716.74
7.4.70.0170.00316.75
7.4.60.0140.00516.66
7.4.50.0180.00316.65
7.4.40.0160.00416.64
7.4.30.0170.00116.65
7.4.20.0120.00716.66
7.4.10.0090.00816.58
7.4.00.0100.00716.63

preferences:
58.84 ms | 1242 KiB | 5 Q