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; //} $x = '{"question":"chicken","modal":"ought to","probability":"high","utilitygain":"low","subcondition":"Edward","rt":2975,"response":"agree","freeResponse":"wvwvwewe"}'; echo $x[count($x)]; ?>

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.68
8.3.50.0100.00921.20
8.3.40.0140.00419.00
8.3.30.0040.01119.19
8.3.20.0000.00820.35
8.3.10.0080.00023.52
8.3.00.0070.00023.65
8.2.180.0090.00616.88
8.2.170.0030.01022.96
8.2.160.0100.00322.12
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00417.74
8.2.110.0090.00022.03
8.2.100.0060.00617.75
8.2.90.0040.00419.30
8.2.80.0000.00817.97
8.2.70.0070.00417.75
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0050.00321.12
8.2.30.0040.00419.78
8.2.20.0000.00817.73
8.2.10.0040.00418.00
8.2.00.0000.00718.13
8.1.280.0140.00025.92
8.1.270.0050.00320.20
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00323.97
8.1.230.0080.00417.48
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0070.00417.35
8.1.190.0040.00417.38
8.1.180.0030.00518.10
8.1.170.0080.00018.44
8.1.160.0000.00722.03
8.1.150.0070.00018.94
8.1.140.0070.00017.34
8.1.130.0030.00317.59
8.1.120.0000.00817.45
8.1.110.0000.00717.48
8.1.100.0070.00017.40
8.1.90.0040.00417.34
8.1.80.0060.00317.43
8.1.70.0070.00017.43
8.1.60.0030.00617.66
8.1.50.0000.00817.62
8.1.40.0060.00317.48
8.1.30.0040.00417.48
8.1.20.0000.00817.55
8.1.10.0050.00217.45
8.1.00.0000.00817.43
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0000.00718.37
8.0.270.0000.00817.18
8.0.260.0030.00317.33
8.0.250.0000.00717.04
8.0.240.0000.00716.95
8.0.230.0030.00516.93
8.0.220.0000.00716.98
8.0.210.0070.00016.90
8.0.200.0040.00417.07
8.0.190.0070.00016.91
8.0.180.0040.00416.88
8.0.170.0040.00416.98
8.0.160.0080.00016.84
8.0.150.0030.00516.95
8.0.140.0040.00416.93
8.0.130.0040.00413.32
8.0.120.0000.00816.95
8.0.110.0040.00416.88
8.0.100.0040.00417.06
8.0.90.0070.00016.83
8.0.80.0030.01516.94
8.0.70.0040.00417.00
8.0.60.0000.00716.97
8.0.50.0000.00816.95
8.0.30.0080.01317.27
8.0.20.0100.00917.40
8.0.10.0020.00516.88
8.0.00.0130.00716.81
7.4.330.0000.00715.19
7.4.320.0060.00016.60
7.4.300.0000.00616.57
7.4.290.0070.00016.54
7.4.280.0040.00416.50
7.4.270.0000.00716.50
7.4.260.0000.00716.64
7.4.250.0070.00016.62
7.4.240.0000.00716.52
7.4.230.0070.00016.71
7.4.220.0100.00716.65
7.4.210.0080.00716.59
7.4.200.0000.00716.37
7.4.160.0040.01116.38
7.4.150.0120.00617.40
7.4.140.0100.01217.86
7.4.130.0060.01116.50
7.4.120.0110.00816.67
7.4.110.0100.01016.45
7.4.100.0120.00616.53
7.4.90.0060.01116.48
7.4.80.0130.00419.39
7.4.70.0070.01116.53
7.4.60.0100.01016.66
7.4.50.0000.00916.46
7.4.40.0140.00716.74
7.4.30.0070.01016.48
7.4.10.0110.00714.65
7.4.00.0090.00815.09
7.3.330.0030.00313.45
7.3.320.0050.00013.31
7.3.310.0050.00216.29
7.3.300.0040.00416.27
7.3.290.0000.00716.36
7.3.280.0110.00816.43
7.3.270.0090.00917.40
7.3.260.0170.00616.45
7.3.250.0090.01016.46
7.3.240.0100.00716.44
7.3.230.0110.00716.65
7.3.210.0120.00616.60
7.3.200.0070.01016.54
7.3.190.0060.01016.51
7.3.180.0130.00416.60
7.3.170.0120.00916.52
7.3.160.0080.01516.51
7.3.130.0100.01014.93
7.3.120.0060.01014.85
7.3.110.0080.00914.93
7.3.100.0110.00715.03
7.3.90.0070.00714.81
7.3.80.0070.00714.99
7.3.70.0100.00614.99
7.3.60.0030.01314.93
7.3.50.0050.01114.86
7.3.40.0060.00914.95
7.3.30.0050.00914.85
7.3.20.0100.00516.78
7.3.10.0060.00616.44
7.3.00.0090.00516.83
7.2.330.0110.00716.83
7.2.320.0030.01416.52
7.2.310.0140.00316.76
7.2.300.0100.00716.88
7.2.290.0100.00716.46
7.2.260.0040.01515.27
7.2.250.0060.01015.23
7.2.240.0070.01014.96
7.2.230.0090.01215.04
7.2.220.0050.01015.30
7.2.210.0090.00514.97
7.2.200.0070.00715.22
7.2.190.0060.00914.98
7.2.180.0080.00415.03
7.2.170.0030.01114.93
7.2.160.0090.00615.26
7.2.150.0040.00817.15
7.2.140.0100.00717.13
7.2.130.0030.00916.84
7.2.120.0090.00616.86
7.2.110.0030.01417.12
7.2.100.0100.00617.06
7.2.90.0040.01117.18
7.2.80.0050.01116.70
7.2.70.0060.01217.11
7.2.60.0050.00917.07
7.2.50.0110.00417.03
7.2.40.0070.01117.03
7.2.30.0070.01117.03
7.2.20.0070.01116.79
7.2.10.0040.01117.03
7.2.00.0070.00718.40
7.1.330.0060.00615.88
7.1.320.0030.01015.81
7.1.310.0070.00815.89
7.1.300.0090.00715.81
7.1.290.0050.00915.78
7.1.280.0050.01016.03
7.1.270.0060.00615.78
7.1.260.0010.01015.89
7.1.250.0000.01315.81
7.1.240.0030.01415.73
7.1.230.0100.00715.75
7.1.220.0030.01015.64
7.1.210.0070.01015.66
7.1.200.0060.00815.90
7.1.190.0030.01215.72
7.1.180.0120.00315.79
7.1.170.0030.01015.53
7.1.160.0040.00715.68
7.1.150.0090.00315.51
7.1.140.0070.00715.55
7.1.130.0070.00715.88
7.1.120.0000.01415.92
7.1.110.0030.01016.02
7.1.100.0080.00817.01
7.1.90.0090.00615.87
7.1.80.0100.00715.51
7.1.70.0060.00616.62
7.1.60.0090.00317.64
7.1.50.0050.01016.33
7.1.40.0090.00615.89
7.1.30.0030.01315.97
7.1.20.0110.00715.80
7.1.10.0060.00915.84
7.1.00.0090.04019.05
7.0.330.0140.01015.45
7.0.320.0160.00815.48
7.0.310.0090.01415.24
7.0.300.0110.01115.24
7.0.290.0080.01515.45
7.0.280.0130.00815.29
7.0.270.0150.01115.30
7.0.260.0090.01415.38
7.0.250.0140.01015.47
7.0.240.0130.01315.61
7.0.230.0190.00615.59
7.0.220.0180.00715.46
7.0.210.0140.01015.57
7.0.200.0070.01216.01
7.0.190.0180.00915.52
7.0.180.0130.01015.27
7.0.170.0180.00615.46
7.0.160.0200.00615.45
7.0.150.0180.00915.26
7.0.140.0160.01015.17
7.0.130.0180.00915.41
7.0.120.0200.00615.40
7.0.110.0100.01615.53
7.0.100.0120.01515.50
7.0.90.0110.01415.43
7.0.80.0150.01015.68
7.0.70.0160.01115.55
7.0.60.0160.04417.68
7.0.50.0120.04716.76
7.0.40.0120.04116.74
7.0.30.0250.04216.78
7.0.20.0200.04516.79
7.0.10.0080.03916.93
7.0.00.0140.04316.79
5.6.400.0130.00714.49
5.6.390.0240.00513.92
5.6.380.0150.01214.73
5.6.370.0160.00814.54
5.6.360.0110.01314.62
5.6.350.0140.01014.30
5.6.340.0170.01014.35
5.6.330.0100.01714.11
5.6.320.0190.00714.84
5.6.310.0170.00914.26
5.6.300.0080.02014.63
5.6.290.0130.01314.43
5.6.280.0100.02317.68
5.6.270.0110.01414.57
5.6.260.0180.00814.56
5.6.250.0130.01614.32
5.6.240.0140.01414.50
5.6.230.0150.00914.52
5.6.220.0150.01214.71
5.6.210.0140.02117.37
5.6.200.0140.02416.17
5.6.190.0080.05317.31
5.6.180.0190.02817.58
5.6.170.0280.02917.49
5.6.160.0150.02917.39
5.6.150.0060.03116.29
5.6.140.0100.02516.30
5.6.130.0140.04316.40
5.6.120.0110.04717.66
5.6.110.0100.03917.68
5.6.100.0110.02617.61
5.6.90.0200.04017.71
5.6.80.0110.03617.43
5.6.70.0130.01314.42
5.6.60.0160.00914.46
5.6.50.0150.01314.31
5.6.40.0190.00814.33
5.6.30.0230.00614.47
5.6.20.0130.01314.30
5.6.10.0130.01314.34
5.6.00.0190.00614.46
5.5.380.0170.00914.33
5.5.370.0130.01014.31
5.5.360.0230.00314.07
5.5.350.0220.02117.37
5.5.340.0120.02516.08
5.5.330.0150.03817.31
5.5.320.0280.04217.46
5.5.310.0180.04717.42
5.5.300.0100.02416.23
5.5.290.0090.03316.26
5.5.280.0090.04117.61
5.5.270.0080.03317.71
5.5.260.0130.02117.42
5.5.250.0080.05117.48
5.5.240.0110.03917.16
5.5.230.0120.01214.41
5.5.220.0140.01014.26
5.5.210.0070.01714.40
5.5.200.0130.01014.41
5.5.190.0180.00814.11
5.5.180.0170.00714.39
5.5.170.0090.01414.55
5.5.160.0110.01314.46
5.5.150.0070.01714.41
5.5.140.0090.01714.42
5.5.130.0130.01314.32
5.5.120.0100.01614.47
5.5.110.0120.01214.17
5.5.100.0150.01114.23
5.5.90.0180.00914.53
5.5.80.0140.01014.12
5.5.70.0130.01314.61
5.5.60.0140.01114.31
5.5.50.0170.00614.25
5.5.40.0080.01514.47
5.5.30.0170.00914.08
5.5.20.0120.01614.46
5.5.10.0200.00614.53
5.5.00.0180.00414.43
5.4.450.0430.03115.25
5.4.440.0350.03815.34
5.4.430.0440.03015.46
5.4.420.0270.02815.37
5.4.410.0060.03615.47
5.4.400.0450.03315.13
5.4.390.0470.03315.13
5.4.380.0420.03215.10
5.4.370.0540.03015.13
5.4.360.0550.03615.23
5.4.350.0570.03214.99
5.4.340.0540.02915.00
5.4.330.0080.00411.36
5.4.320.0480.03715.15
5.4.310.0420.03415.23
5.4.300.0560.02815.21
5.4.290.0480.03115.19
5.4.280.0280.04415.16
5.4.270.0560.03315.21
5.4.260.0440.02715.15
5.4.250.0380.03915.35
5.4.240.0380.03015.10
5.4.230.0380.03815.13
5.4.220.0410.03115.18
5.4.210.0420.03015.17
5.4.200.0390.03213.92
5.4.190.0450.03815.02
5.4.180.0630.03315.15
5.4.170.0370.03215.04
5.4.160.0440.03015.15
5.4.150.0440.02415.09
5.4.140.0400.03214.04
5.4.130.0450.03013.91
5.4.120.0510.02313.84
5.4.110.0460.02913.77
5.4.100.0620.02713.82
5.4.90.0460.02213.79
5.4.80.0370.03013.68
5.4.70.0480.02413.67
5.4.60.0410.03213.85
5.4.50.0400.02813.74
5.4.40.0450.02813.80
5.4.30.0390.02813.82
5.4.20.0330.03413.81
5.4.10.0440.03013.75
5.4.00.0450.03213.48
5.3.290.0630.05714.64
5.3.280.0770.05714.52
5.3.270.0070.06314.71
5.3.260.0100.05014.83
5.3.250.0070.05714.66
5.3.240.0570.07014.62
5.3.230.1130.06314.70
5.3.220.0370.06714.60
5.3.210.0000.06714.48
5.3.200.0130.04714.48
5.3.190.0830.06314.57
5.3.180.0700.05014.79
5.3.170.0770.05014.59
5.3.160.0700.05014.57
5.3.150.0770.06714.57
5.3.140.0770.06314.53
5.3.130.0870.05014.77
5.3.120.0870.05314.46
5.3.110.0870.07014.54
5.3.100.0800.04313.87
5.3.90.0570.05713.93
5.3.80.0800.05314.24
5.3.70.0800.05313.93
5.3.60.0800.05313.92
5.3.50.1100.04313.86
5.3.40.1070.06013.86
5.3.30.0700.06313.93
5.3.20.1070.05013.60
5.3.10.0930.04013.57
5.3.00.0770.06313.73
5.2.170.0730.04711.06
5.2.160.0570.05311.16
5.2.150.0600.04711.22
5.2.140.0900.03311.08
5.2.130.0700.04010.97
5.2.120.0800.02311.18
5.2.110.0630.04311.12
5.2.100.0830.04311.02
5.2.90.0670.04011.01
5.2.80.0730.03711.11
5.2.70.0830.05011.17
5.2.60.0670.04010.92
5.2.50.0730.03710.99
5.2.40.0570.05310.91
5.2.30.0570.04310.87
5.2.20.0570.02711.06
5.2.10.0470.03310.77
5.2.00.0400.04010.70
5.1.60.0670.0379.98
5.1.50.0600.0339.84
5.1.40.0400.0379.91
5.1.30.0530.03010.31
5.1.20.0570.04310.41
5.1.10.0700.03710.23
5.1.00.0530.0479.98
5.0.50.0330.0238.61
5.0.40.0300.0278.31
5.0.30.0330.0438.24
5.0.20.0330.0308.29
5.0.10.0430.0338.42
5.0.00.0300.0408.06
4.4.90.0300.0175.79
4.4.80.0200.0275.86
4.4.70.0300.0205.84
4.4.60.0370.0235.84
4.4.50.0270.0235.87
4.4.40.0330.0335.85
4.4.30.0330.0235.88
4.4.20.0300.0205.82
4.4.10.0370.0305.91
4.4.00.0170.0505.88
4.3.110.0400.0205.85
4.3.100.0170.0235.82
4.3.90.0170.0305.77
4.3.80.0300.0305.73
4.3.70.0230.0235.70
4.3.60.0230.0275.70
4.3.50.0330.0175.77
4.3.40.0230.0335.72
4.3.30.0130.0234.52
4.3.20.0130.0204.52
4.3.10.0130.0204.38
4.3.00.0070.0238.54

preferences:
66.48 ms | 401 KiB | 5 Q