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"; $data = ""; // one line for each trial data point, starting with header items, then trial data foreach (array_values($trialData) as $trialStr) { $trialParsed = parseTrialData($trialStr); foreach (array_values($trialParsed) as $trialDataPoint) { $data .= $trialDataPoint . ","; } $data = mb_substr(data, 0, -1) . "\n"; } echo $data; ?>

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.33
8.3.50.0190.00521.32
8.3.40.0160.00018.80
8.3.30.0140.00319.22
8.3.20.0060.00320.30
8.3.10.0040.00423.61
8.3.00.0080.00023.46
8.2.180.0140.00716.60
8.2.170.0110.00422.96
8.2.160.0140.00022.11
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0000.00826.16
8.2.120.0060.00317.63
8.2.110.0090.00019.33
8.2.100.0090.00317.84
8.2.90.0040.00419.13
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0080.00018.03
8.2.50.0030.00618.10
8.2.40.0040.00421.00
8.2.30.0000.00819.77
8.2.20.0000.00717.89
8.2.10.0040.00418.07
8.2.00.0040.00418.12
8.1.280.0110.00425.92
8.1.270.0000.00820.25
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00022.20
8.1.230.0000.01117.77
8.1.220.0030.00617.79
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0040.00418.61
8.1.160.0000.00821.93
8.1.150.0020.00518.82
8.1.140.0040.00417.37
8.1.130.0030.00317.70
8.1.120.0040.00417.51
8.1.110.0070.00017.49
8.1.100.0000.00717.44
8.1.90.0040.00417.41
8.1.80.0030.00617.43
8.1.70.0030.00317.41
8.1.60.0040.00417.49
8.1.50.0000.00817.43
8.1.40.0000.00817.56
8.1.30.0000.00817.53
8.1.20.0040.00417.63
8.1.10.0040.00417.64
8.1.00.0000.00717.59
8.0.300.0040.00419.65
8.0.290.0030.00616.88
8.0.280.0040.00418.44
8.0.270.0030.00317.24
8.0.260.0030.00317.24
8.0.250.0000.00717.09
8.0.240.0030.00317.07
8.0.230.0070.00017.06
8.0.220.0000.00717.07
8.0.210.0030.00317.01
8.0.200.0050.00216.96
8.0.190.0000.00816.98
8.0.180.0040.00417.09
8.0.170.0080.00016.98
8.0.160.0000.00716.98
8.0.150.0040.00417.01
8.0.140.0040.00316.86
8.0.130.0040.00413.42
8.0.120.0080.00017.07
8.0.110.0070.00017.05
8.0.100.0080.00016.99
8.0.90.0080.00016.93
8.0.80.0090.00617.00
8.0.70.0060.00317.10
8.0.60.0050.00317.08
8.0.50.0080.00017.03
8.0.30.0110.00817.04
8.0.20.0100.00917.40
8.0.10.0020.00516.93
8.0.00.0080.00916.85
7.4.330.0000.00515.08
7.4.320.0060.00016.52
7.4.300.0030.00316.56
7.4.290.0040.00416.62
7.4.280.0070.00016.52
7.4.270.0070.00016.51
7.4.260.0040.00416.64
7.4.250.0050.00316.51
7.4.240.0030.00416.55
7.4.230.0070.00016.38
7.4.220.0090.00916.62
7.4.210.0080.00916.51
7.4.200.0000.00716.60
7.4.160.0140.00216.64
7.4.150.0070.01117.40
7.4.140.0120.01017.86
7.4.130.0090.01016.63
7.4.120.0090.01016.52
7.4.110.0130.01016.60
7.4.100.0160.00716.67
7.4.90.0000.01616.57
7.4.80.0130.00719.39
7.4.70.0100.00716.68
7.4.60.0060.00916.42
7.4.50.0060.00316.69
7.4.40.0140.00316.54
7.4.30.0090.00916.32
7.4.10.0130.00315.21
7.4.00.0080.00914.99
7.3.330.0000.00613.32
7.3.320.0050.00013.44
7.3.310.0000.00716.48
7.3.300.0030.00316.42
7.3.290.0000.00716.45
7.3.280.0110.00816.41
7.3.270.0120.00617.40
7.3.260.0150.00916.49
7.3.250.0100.00916.49
7.3.240.0060.01616.59
7.3.230.0030.01416.43
7.3.210.0030.01316.53
7.3.200.0040.01816.51
7.3.190.0040.01216.51
7.3.180.0080.00816.64
7.3.170.0090.00916.61
7.3.160.0070.01416.46
7.3.130.0120.00414.74
7.3.120.0060.01014.75
7.3.110.0140.00314.99
7.3.100.0090.00814.83
7.3.90.0110.00314.93
7.3.80.0070.00914.94
7.3.70.0070.00914.79
7.3.60.0050.01114.79
7.3.50.0100.00614.91
7.3.40.0050.01014.95
7.3.30.0060.00614.79
7.3.20.0030.01016.49
7.3.10.0050.00916.70
7.3.00.0080.00316.69
7.2.330.0060.00916.57
7.2.320.0100.00716.84
7.2.310.0210.00316.86
7.2.300.0110.00816.49
7.2.290.0080.00816.44
7.2.260.0000.01514.95
7.2.250.0100.00815.16
7.2.240.0100.00815.16
7.2.230.0080.00815.10
7.2.220.0050.01315.05
7.2.210.0100.00715.02
7.2.200.0090.00214.98
7.2.190.0090.00815.17
7.2.180.0070.00515.01
7.2.170.0030.01015.09
7.2.160.0020.01415.10
7.2.150.0070.00816.91
7.2.140.0060.00517.01
7.2.130.0070.00916.93
7.2.120.0070.00516.81
7.2.110.0070.00716.66
7.2.100.0080.00816.90
7.2.90.0050.00816.91
7.2.80.0030.01317.02
7.2.70.0080.00816.97
7.2.60.0090.00416.72
7.2.50.0110.00817.01
7.2.40.0080.00616.84
7.2.30.0060.00816.95
7.2.20.0050.00716.91
7.2.10.0110.00516.91
7.2.00.0050.00917.98
7.1.330.0050.01015.83
7.1.320.0090.00316.02
7.1.310.0040.00915.78
7.1.300.0060.00815.87
7.1.290.0070.00915.68
7.1.280.0110.00415.90
7.1.270.0060.00815.82
7.1.260.0070.00915.66
7.1.250.0050.00715.83
7.1.240.0060.00815.61
7.1.230.0050.00815.88
7.1.220.0060.00615.58
7.1.210.0040.00915.67
7.1.200.0120.00515.86
7.1.190.0060.00715.98
7.1.180.0080.00515.94
7.1.170.0060.00715.84
7.1.160.0090.00515.75
7.1.150.0090.00215.87
7.1.140.0080.00515.91
7.1.130.0060.00615.86
7.1.120.0040.00715.77
7.1.110.0070.00715.73
7.1.100.0100.00516.67
7.1.90.0080.00815.81
7.1.80.0070.00815.85
7.1.70.0060.00616.31
7.1.60.0080.00917.04
7.1.50.0070.00916.21
7.1.40.0060.00515.66
7.1.30.0060.00615.79
7.1.20.0010.01315.83
7.1.10.0080.00715.75
7.1.00.0050.02717.97
7.0.330.0040.00715.47
7.0.320.0070.00715.31
7.0.310.0040.00915.61
7.0.300.0060.00815.43
7.0.290.0070.00715.47
7.0.280.0080.00315.30
7.0.270.0060.00615.32
7.0.260.0080.00715.34
7.0.250.0030.01315.37
7.0.240.0040.00915.27
7.0.230.0070.00715.54
7.0.220.0070.00615.42
7.0.210.0060.00915.40
7.0.200.0020.00915.82
7.0.190.0050.00715.46
7.0.180.0000.01215.31
7.0.170.0080.00615.46
7.0.160.0060.00715.38
7.0.150.0070.00615.55
7.0.140.0040.01015.59
7.0.130.0030.01115.43
7.0.120.0050.00915.23
7.0.110.0050.00815.34
7.0.100.0080.00815.54
7.0.90.0060.00415.45
7.0.80.0030.01015.48
7.0.70.0070.00415.52
7.0.60.0080.02716.90
7.0.50.0050.03316.29
7.0.40.0040.02016.04
7.0.30.0130.03516.17
7.0.20.0180.02916.01
7.0.10.0040.03716.04
7.0.00.0050.03116.12
5.6.400.0110.00314.44
5.6.390.0050.00914.71
5.6.380.0070.00714.67
5.6.370.0060.00914.52
5.6.360.0060.00914.72
5.6.350.0050.01014.60
5.6.340.0020.01314.53
5.6.330.0070.00514.56
5.6.320.0020.00814.70
5.6.310.0040.01114.68
5.6.300.0040.00914.49
5.6.290.0030.01114.66
5.6.280.0030.02316.63
5.6.270.0050.00814.65
5.6.260.0080.00914.64
5.6.250.0080.00514.54
5.6.240.0020.01214.74
5.6.230.0060.00514.57
5.6.220.0020.01214.65
5.6.210.0050.01916.52
5.6.200.0030.02315.64
5.6.190.0080.03016.45
5.6.180.0150.02016.63
5.6.170.0120.03316.45
5.6.160.0030.03516.45
5.6.150.0040.03315.75
5.6.140.0050.02915.74
5.6.130.0080.02115.79
5.6.120.0060.02416.72
5.6.110.0030.03616.71
5.6.100.0080.03116.69
5.6.90.0050.03516.63
5.6.80.0130.02816.49
5.6.70.0080.00714.64
5.6.60.0060.01114.39
5.6.50.0050.01014.57
5.6.40.0070.00514.52
5.6.30.0020.01014.60
5.6.20.0100.00614.36
5.6.10.0070.00914.59
5.6.00.0030.01014.52
5.5.380.0020.01214.51
5.5.370.0070.00514.47
5.5.360.0090.00414.46
5.5.350.0120.02716.44
5.5.340.0070.03315.54
5.5.330.0050.03316.45
5.5.320.0090.02016.41
5.5.310.0130.03416.38
5.5.300.0090.02915.74
5.5.290.0030.02215.72
5.5.280.0020.02316.57
5.5.270.0110.02716.52
5.5.260.0050.02016.50
5.5.250.0080.02616.51
5.5.240.0040.01616.35
5.5.230.0050.01014.56
5.5.220.0060.00814.45
5.5.210.0030.01214.37
5.5.200.0060.00814.44
5.5.190.0050.01014.46
5.5.180.0030.01014.42
5.5.170.0060.00614.34
5.5.160.0120.00414.43
5.5.150.0030.01414.33
5.5.140.0050.01214.54
5.5.130.0020.01314.50
5.5.120.0080.00714.42
5.5.110.0030.01214.42
5.5.100.0050.01114.43
5.5.90.0080.00714.37
5.5.80.0050.00914.36
5.5.70.0070.00714.33
5.5.60.0060.01014.42
5.5.50.0050.00914.41
5.5.40.0050.01014.55
5.5.30.0080.00814.49
5.5.20.0060.00714.57
5.5.10.0040.00914.31
5.5.00.0080.00514.34
5.4.450.0090.02815.00
5.4.440.0330.02115.19
5.4.430.0280.02214.97
5.4.420.0200.02815.07
5.4.410.0260.02415.12
5.4.400.0280.02614.89
5.4.390.0310.02114.99
5.4.380.0320.01914.97
5.4.370.0280.02214.97
5.4.360.0230.02615.01
5.4.350.0190.02414.87
5.4.340.0260.02114.82
5.4.330.0010.01012.81
5.4.320.0290.02314.93
5.4.310.0290.02315.05
5.4.300.0340.01814.95
5.4.290.0340.01914.91
5.4.280.0330.01814.99
5.4.270.0310.01815.08
5.4.260.0340.02115.08
5.4.250.0270.02515.04
5.4.240.0280.02614.98
5.4.230.0320.02114.87
5.4.220.0310.02114.87
5.4.210.0300.02114.89
5.4.200.0310.02414.15
5.4.190.0300.02314.85
5.4.180.0300.02314.95
5.4.170.0250.02814.75
5.4.160.0280.02414.75
5.4.150.0310.02414.84
5.4.140.0350.02114.03
5.4.130.0290.02114.01
5.4.120.0280.02714.02
5.4.110.0330.02114.08
5.4.100.0270.02614.04
5.4.90.0270.02414.09
5.4.80.0350.02513.96
5.4.70.0310.02014.00
5.4.60.0300.01813.99
5.4.50.0310.01814.03
5.4.40.0240.02113.94
5.4.30.0210.03013.88
5.4.20.0260.02414.02
5.4.10.0300.02214.10
5.4.00.0280.01813.95
5.3.290.0930.04314.64
5.3.280.0630.07014.60
5.3.270.0800.05014.84
5.3.260.0800.06314.47
5.3.250.0900.05014.58
5.3.240.0900.06014.70
5.3.230.0800.05714.50
5.3.220.0870.04714.53
5.3.210.0870.06014.57
5.3.200.0830.05314.65
5.3.190.0830.05314.48
5.3.180.0570.05314.65
5.3.170.0800.05314.62
5.3.160.0700.04714.43
5.3.150.0730.04314.58
5.3.140.0530.05714.52
5.3.130.0870.05014.52
5.3.120.0770.05314.54
5.3.110.0600.06014.56
5.3.100.0670.08014.19
5.3.90.0470.05014.02
5.3.80.0700.05013.88
5.3.70.0670.05314.03
5.3.60.0730.05014.06
5.3.50.0800.05014.02
5.3.40.0700.05313.96
5.3.30.0630.05714.14
5.3.20.0730.04013.78
5.3.10.0730.04313.59
5.3.00.0600.05313.55
5.2.170.0470.05711.30
5.2.160.0630.03711.07
5.2.150.0570.03711.21
5.2.140.0770.04711.16
5.2.130.0530.05311.16
5.2.120.0500.04311.26
5.2.110.0730.04711.02
5.2.100.0530.04311.00
5.2.90.0700.04711.33
5.2.80.0570.03711.01
5.2.70.0770.04711.11
5.2.60.0670.04010.97
5.2.50.0530.04711.04
5.2.40.0600.04711.08
5.2.30.0500.05710.93
5.2.20.0370.05010.97
5.2.10.0630.04010.72
5.2.00.0670.04710.81
5.1.60.0630.0279.95
5.1.50.0670.04010.08
5.1.40.0430.0339.88
5.1.30.0370.04010.25
5.1.20.0400.04010.31
5.1.10.0400.03310.00
5.1.00.0500.04710.30
5.0.50.0200.0308.50
5.0.40.0100.0408.36
5.0.30.0270.0438.16
5.0.20.0370.0308.19
5.0.10.0200.0278.25
5.0.00.0270.0378.24
4.4.90.0130.0305.87
4.4.80.0170.0235.86
4.4.70.0170.0205.77
4.4.60.0300.0175.85
4.4.50.0270.0235.79
4.4.40.0230.0405.77
4.4.30.0230.0235.79
4.4.20.0230.0236.01
4.4.10.0230.0205.91
4.4.00.0270.0375.80
4.3.110.0270.0175.76
4.3.100.0230.0275.75
4.3.90.0100.0275.68
4.3.80.0330.0335.77
4.3.70.0230.0205.70
4.3.60.0270.0175.75
4.3.50.0170.0205.77
4.3.40.0200.0335.69
4.3.30.0130.0234.45
4.3.20.0130.0234.50
4.3.10.0070.0234.43
4.3.00.0070.0207.18

preferences:
57.31 ms | 401 KiB | 5 Q