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 (substr($value[1], 0, 1) == '{' and substr($value, -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 .= $key . ","; } } $header .= $globalHeader . $localHeader; $header = substr($header, 0, -1) . "\n"; foreach $array_keys($headerItems) as $key { echo $key; } ?>

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)
5.6.120.0130.07720.99
5.6.110.0030.08721.20
5.6.100.0130.06721.02
5.6.90.0030.08721.04
5.6.80.0070.08020.30
5.6.70.4530.03720.44
5.5.280.0170.06720.91
5.5.270.0070.07320.90
5.5.260.0100.05320.64
5.5.250.0000.04320.70
5.5.240.0270.06720.08
5.4.440.0570.06719.45
5.4.430.0400.05319.30
5.4.420.0170.04319.63
5.4.410.0400.04719.57
5.4.400.0670.05019.28
5.4.390.0270.06019.16
5.4.380.0030.05718.87
5.4.370.0500.05319.01
5.4.360.0770.05019.38
5.4.350.0170.05719.00
5.4.340.0170.05019.05
5.4.320.0700.06318.88
5.4.310.0530.05719.29
5.4.300.0400.06019.33
5.4.290.0130.04719.37
5.4.280.0430.05319.12
5.4.270.0870.05719.13
5.4.260.0830.04319.16
5.4.250.0470.05719.25
5.4.240.0530.06019.12
5.4.230.0600.04719.15
5.4.220.0200.05719.14
5.4.210.0500.05719.08
5.4.200.0830.04016.79
5.4.190.0770.05719.16
5.4.180.0600.05719.35
5.4.170.0700.05719.07
5.4.160.0730.06719.18
5.4.150.0900.04319.20
5.4.140.0670.05716.34
5.4.130.1000.04716.51
5.4.120.1030.04716.53
5.4.110.0770.06016.45
5.4.100.0970.05716.56
5.4.90.0870.07016.34
5.4.80.0800.06316.43
5.4.70.1230.06716.32
5.4.60.1200.04016.33
5.4.50.0930.05716.31
5.4.40.0870.05316.31
5.4.30.0930.04716.37
5.4.20.0730.07016.52
5.4.10.0830.05016.27
5.4.00.0830.04015.96
5.3.290.0970.06014.90
5.3.280.1070.06714.61
5.3.270.0930.05314.62
5.3.260.0670.05714.58
5.3.250.0830.06314.51
5.3.240.1070.04714.52
5.3.230.0730.05314.51
5.3.220.0830.05014.65
5.3.210.0770.05714.57
5.3.200.0930.05014.59
5.3.190.1070.07014.79
5.3.180.0830.04714.65
5.3.170.0830.05714.55
5.3.160.1030.04714.58
5.3.150.1030.08314.46
5.3.140.1070.04714.57
5.3.130.0970.05014.56
5.3.120.0870.05714.70
5.3.110.0700.06714.52
5.3.100.0900.04714.03
5.3.90.1170.04714.07
5.3.80.1030.06013.93
5.3.70.0670.04713.93
5.3.60.0770.04713.93
5.3.50.0870.05013.96
5.3.40.0770.05714.10
5.3.30.0700.05013.78
5.3.20.0670.05013.55
5.3.10.0770.06313.56
5.3.00.0870.05713.65
5.2.170.1030.06711.08
5.2.160.0730.06011.18
5.2.150.0730.07011.06
5.2.140.0630.04311.30
5.2.130.0570.05010.97
5.2.120.1030.04311.03
5.2.110.0670.03711.11
5.2.100.0530.04311.33
5.2.90.0800.04311.16
5.2.80.1100.04711.11
5.2.70.0730.06311.02
5.2.60.0770.05711.14
5.2.50.0570.04011.24
5.2.40.0500.04010.95
5.2.30.0500.04311.06
5.2.20.0570.05311.18
5.2.10.0730.04310.77
5.2.00.0600.04010.63
5.1.60.0600.0579.84
5.1.50.0700.0379.88
5.1.40.0430.0439.91
5.1.30.0700.04710.43
5.1.20.0570.04310.27
5.1.10.0600.03010.00
5.1.00.0500.03710.06
5.0.50.0170.0338.62
5.0.40.0370.0278.43
5.0.30.0270.0578.29
5.0.20.0470.0338.20
5.0.10.0300.0378.24
5.0.00.0330.0478.11
4.4.90.0170.0235.91
4.4.80.0400.0305.77
4.4.70.0330.0235.87
4.4.60.0230.0275.77
4.4.50.0230.0275.78
4.4.40.0370.0335.85
4.4.30.0270.0275.79
4.4.20.0370.0205.91
4.4.10.0200.0235.96
4.4.00.0200.0405.88
4.3.110.0330.0205.88
4.3.100.0300.0235.77
4.3.90.0200.0235.76
4.3.80.0470.0205.75
4.3.70.0370.0205.69
4.3.60.0230.0175.75
4.3.50.0270.0275.78
4.3.40.0330.0475.73
4.3.30.0170.0304.54
4.3.20.0100.0234.52
4.3.10.0170.0274.48
4.3.00.0100.0208.54

preferences:
141.56 ms | 1398 KiB | 7 Q