3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'q0data' => '{"question":"chicken","modal":"ought to","probability":"high","utilitygain":"low","subcondition":"Edward","rt":2975,"response":"agree","freeResponse":"wvwvwewe"}', 'q1data' => '{"question":"procrastinate","modal":"ought to","probability":"low","utilitygain":"high","subcondition":"accept","rt":2603,"response":"disagree","freeResponse":"vwevewvewvewvew"}', 'language' => 'vewoievwnpio', 'payment' => 'ceeqqecqeq' ); function parseTrialData ($trialData) { $trialData = substr($trialData, 1, -1); // get rid of leading '{' and trailing '}' $trialData = explode(',', $trialData); // 'explode' is PHP for 'split' // i.e., separate the string into an array of strings of form 'key:value' $parsedTrialData = array(); foreach ($trialData as $kv) { $exploded = explode(':', $kv); $parsedTrialData[$exploded[0]] = $exploded[1]; } return $parsedTrialData; } $headerItems = array(); $trialData = array(); foreach (array_keys($arr) as $key) { $value = $arr[$key]; if (mb_substr($value, 0, 1) == '{' and mb_substr($value, strlen($value) - 1, 1) == '}') { // if the data starts and ends with '{', '}' then it's a complex data object representing a single trial. // so, add the key-value pair to $trialData array to await further processing $trialData[$key] = $value; } else { // otherwise, it's data shared across all trials; so add the pair to the $headerItems array $headerItems[$key] = $value; } } $header = ""; // for new files, make header showing variable names $globalHeader = ""; foreach (array_keys($headerItems) as $key) { $globalHeader .= $key . ","; } $localHeader = ""; if (count($trialData) !== 0) { $parsedSampleTrialData = parseTrialData(array_values($trialData)[0]); foreach (array_keys($parsedSampleTrialData) as $key) { $localHeader .= substr($key, 1, -1) . ","; } } $header .= $globalHeader . $localHeader; $header = substr($header, 0, -1) . "\n"; foreach (array_values($trialData) as $trialStr) { echo $trialStr . "\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.60.0110.00718.41
8.3.50.0140.01221.04
8.3.40.0070.00718.88
8.3.30.0130.00619.21
8.3.20.0050.00320.06
8.3.10.0030.00523.61
8.3.00.0030.00523.48
8.2.180.0070.01118.54
8.2.170.0070.00722.96
8.2.160.0090.00622.13
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0070.00317.75
8.2.110.0000.00919.27
8.2.100.0090.00317.63
8.2.90.0030.00619.21
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0000.00821.02
8.2.30.0000.00819.99
8.2.20.0000.00817.75
8.2.10.0000.00718.09
8.2.00.0040.00418.19
8.1.280.0100.00725.92
8.1.270.0000.00820.38
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0060.00322.27
8.1.230.0070.00417.76
8.1.220.0040.00417.76
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0000.00818.49
8.1.160.0050.00221.94
8.1.150.0000.00818.90
8.1.140.0050.00217.38
8.1.130.0070.00017.78
8.1.120.0000.00817.47
8.1.110.0000.00717.52
8.1.100.0030.00317.44
8.1.90.0040.00417.47
8.1.80.0000.00717.48
8.1.70.0070.00017.48
8.1.60.0040.00417.48
8.1.50.0000.00817.43
8.1.40.0050.00317.54
8.1.30.0050.00317.50
8.1.20.0040.00417.77
8.1.10.0040.00417.66
8.1.00.0000.00817.59
8.0.300.0070.00018.77
8.0.290.0020.00516.75
8.0.280.0000.00718.60
8.0.270.0000.00717.25
8.0.260.0000.00717.27
8.0.250.0000.00717.02
8.0.240.0000.00617.05
8.0.230.0070.00016.94
8.0.220.0000.00817.01
8.0.210.0070.00016.94
8.0.200.0000.00717.09
8.0.190.0020.00517.07
8.0.180.0040.00416.89
8.0.170.0040.00416.98
8.0.160.0040.00417.02
8.0.150.0040.00416.87
8.0.140.0000.00716.88
8.0.130.0030.00313.33
8.0.120.0000.00816.84
8.0.110.0020.00516.92
8.0.100.0000.00716.86
8.0.90.0030.00516.95
8.0.80.0070.01017.00
8.0.70.0000.00917.09
8.0.60.0080.00016.83
8.0.50.0000.00717.02
8.0.30.0070.00917.21
8.0.20.0140.00717.44
8.0.10.0000.00717.02
8.0.00.0160.00416.73
7.4.330.0050.00015.16
7.4.320.0000.00616.43
7.4.300.0030.00316.47
7.4.290.0000.00716.59
7.4.280.0040.00416.41
7.4.270.0040.00416.67
7.4.260.0070.00016.61
7.4.250.0040.00416.46
7.4.240.0040.00416.47
7.4.230.0070.00016.69
7.4.220.0070.01116.60
7.4.210.0050.01016.59
7.4.200.0000.00716.33
7.4.160.0120.00416.45
7.4.150.0030.01417.40
7.4.140.0160.00517.86
7.4.130.0060.01116.63
7.4.120.0160.00716.51
7.4.110.0110.00716.65
7.4.100.0060.01216.43
7.4.90.0070.01016.44
7.4.80.0080.00819.39
7.4.70.0100.00716.48
7.4.60.0080.00816.60
7.4.50.0040.00416.39
7.4.40.0160.00616.57
7.4.30.0120.00916.41
7.4.00.0120.00614.73
7.3.330.0030.00313.25
7.3.320.0060.00013.25
7.3.310.0080.00016.41
7.3.300.0040.00416.38
7.3.290.0030.00316.42
7.3.280.0100.00716.35
7.3.270.0090.00817.40
7.3.260.0090.00916.50
7.3.250.0130.00616.53
7.3.240.0110.00616.48
7.3.230.0130.00316.48
7.3.210.0030.01316.39
7.3.200.0140.00416.40
7.3.190.0070.00716.61
7.3.180.0060.00916.27
7.3.170.0080.00816.71
7.3.160.0100.01316.43
7.3.10.0060.00816.39
7.3.00.0060.00816.62
7.2.330.0140.00416.86
7.2.320.0080.00816.89
7.2.310.0130.01316.90
7.2.300.0080.01116.78
7.2.290.0030.01416.52
7.2.130.0090.00617.00
7.2.120.0060.00916.94
7.2.110.0060.00916.80
7.2.100.0120.00017.12
7.2.90.0090.00617.08
7.2.80.0040.01016.89
7.2.70.0040.01117.27
7.2.60.0090.00316.92
7.2.50.0030.00717.12
7.2.40.0040.00816.98
7.2.30.0090.00316.75
7.2.20.0000.01116.79
7.2.10.0000.01416.57
7.2.00.0060.00918.19
7.1.250.0100.00315.90
7.1.200.0000.01315.82
7.1.100.0890.01016.23
7.1.70.0050.00517.32
7.1.60.0060.00619.42
7.1.50.0030.01016.70
7.1.00.0000.07722.36
7.0.200.0040.00816.80
7.0.60.0070.08719.89
7.0.50.0130.05017.90
7.0.40.0070.08720.02
7.0.30.0230.04720.28
7.0.20.0230.04320.16
7.0.10.0070.06020.11
7.0.00.0030.09020.27
5.6.280.0030.04321.04
5.6.210.0070.03720.72
5.6.200.0070.07718.13
5.6.190.0170.08020.46
5.6.180.0300.05020.55
5.6.170.0230.07020.48
5.6.160.0100.07720.52
5.6.150.0070.05318.29
5.6.140.0230.05018.23
5.6.130.0000.04718.23
5.6.120.0070.05321.14
5.6.110.0030.09021.13
5.6.100.0130.08020.99
5.6.90.0130.07720.98
5.6.80.0100.08320.39
5.5.350.0230.08020.39
5.5.340.0070.04017.99
5.5.330.0070.08720.27
5.5.320.0500.07020.36
5.5.310.0330.06320.30
5.5.300.0130.07718.08
5.5.290.0070.06717.97
5.5.280.0070.08020.91
5.5.270.0170.07320.92
5.5.260.0070.04020.63
5.5.250.0200.06720.59
5.5.240.0030.03720.24
5.4.450.0670.05719.45
5.4.440.0130.06719.67
5.4.430.0170.06019.54
5.4.420.0200.06019.47
5.4.410.0230.05719.46
5.4.400.0230.05019.23
5.4.390.0170.06719.12
5.4.380.0100.06019.27
5.4.370.0370.05019.27
5.4.360.0200.06018.98
5.4.350.0170.06719.22
5.4.340.0330.06319.06
5.4.320.0230.05019.24
5.4.310.0330.05019.26
5.4.300.0370.05719.34
5.4.290.0230.06719.05
5.4.280.0370.04718.97
5.4.270.0200.06019.25
5.4.260.0230.05019.18
5.4.250.0300.06019.14
5.4.240.0130.06319.14
5.4.230.0370.05719.21
5.4.220.0300.06319.18
5.4.210.0200.05719.18
5.4.200.0200.05316.95
5.4.190.0200.05719.02
5.4.180.0330.04719.08
5.4.170.0230.07019.12
5.4.160.0230.05319.18
5.4.150.0170.05319.10
5.4.140.0300.04716.44
5.4.130.0200.04716.35
5.4.120.0270.04016.41
5.4.110.0270.05016.32
5.4.100.0230.06016.52
5.4.90.0270.04716.40
5.4.80.0270.04716.49
5.4.70.0230.05016.51
5.4.60.0230.05716.31
5.4.50.0230.05716.53
5.4.40.0230.04716.48
5.4.30.0270.04316.38
5.4.20.0100.05716.37
5.4.10.0100.05716.40
5.4.00.0230.05015.80
5.3.290.0170.06314.69
5.3.280.0270.05014.62
5.3.270.0270.07314.76
5.3.260.0230.05014.83
5.3.250.0170.05314.76
5.3.240.0130.05714.57
5.3.230.0370.05714.61
5.3.220.0230.05014.63
5.3.210.0130.06014.58
5.3.200.0270.07014.47
5.3.190.0330.05714.57
5.3.180.0200.05014.57
5.3.170.0200.07014.48
5.3.160.0300.04714.58
5.3.150.0170.06014.43
5.3.140.0100.06014.42
5.3.130.0200.05314.54
5.3.120.0170.05714.60
5.3.110.0230.05014.57
5.3.100.0070.06014.03
5.3.90.0070.06713.93
5.3.80.0230.06314.07
5.3.70.0170.05014.07
5.3.60.0230.05014.23
5.3.50.0100.05713.86
5.3.40.0130.07014.02
5.3.30.0170.05313.84
5.3.20.0230.04313.59
5.3.10.0130.05713.71
5.3.00.0070.06313.57
5.2.170.0170.04011.16
5.2.160.0100.04311.02
5.2.150.0100.04711.07
5.2.140.0200.04011.21
5.2.130.0230.05311.01
5.2.120.0200.04311.17
5.2.110.0170.03711.12
5.2.100.0130.04311.16
5.2.90.0170.03711.06
5.2.80.0200.03710.96
5.2.70.0170.04310.96
5.2.60.0230.03010.96
5.2.50.0270.03311.11
5.2.40.0070.04311.15
5.2.30.0170.03711.02
5.2.20.0070.04310.89
5.2.10.0230.03010.78
5.2.00.0100.04310.59
5.1.60.0130.0309.91
5.1.50.0070.03710.01
5.1.40.0130.0309.98
5.1.30.0170.03010.34
5.1.20.0170.03310.38
5.1.10.0100.0379.98
5.1.00.0070.04010.00
5.0.50.0130.0238.46
5.0.40.0100.0238.50
5.0.30.0100.0438.17
5.0.20.0130.0238.09
5.0.10.0100.0278.34
5.0.00.0070.0438.33
4.4.90.0030.0235.91
4.4.80.0030.0335.86
4.4.70.0030.0275.89
4.4.60.0030.0235.86
4.4.50.0030.0235.80
4.4.40.0070.0335.81
4.4.30.0030.0235.87
4.4.20.0030.0275.90
4.4.10.0070.0205.84
4.4.00.0030.0405.88
4.3.110.0100.0175.73
4.3.100.0100.0175.78
4.3.90.0070.0205.68
4.3.80.0030.0375.75
4.3.70.0070.0205.85
4.3.60.0030.0205.77
4.3.50.0070.0205.72
4.3.40.0030.0335.64
4.3.30.0000.0274.45
4.3.20.0100.0174.42
4.3.10.0130.0174.38
4.3.00.0100.0207.18

preferences:
76.71 ms | 401 KiB | 5 Q