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[-1]; ?>

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.0070.01018.43
8.3.50.0110.00921.21
8.3.40.0070.01118.96
8.3.30.0060.00919.07
8.3.20.0080.00620.16
8.3.10.0070.00023.65
8.3.00.0050.00323.41
8.2.180.0090.00618.41
8.2.170.0100.00322.96
8.2.160.0060.00922.21
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00517.63
8.2.110.0030.00720.54
8.2.100.0090.00317.84
8.2.90.0000.00819.43
8.2.80.0000.00817.97
8.2.70.0000.00817.75
8.2.60.0080.00017.50
8.2.50.0000.00917.63
8.2.40.0040.00417.92
8.2.30.0000.00819.90
8.2.20.0080.00017.76
8.2.10.0070.00018.09
8.2.00.0080.00018.19
8.1.280.0120.00325.92
8.1.270.0060.00620.38
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.01023.90
8.1.230.0070.00423.96
8.1.220.0050.00317.76
8.1.210.0040.00418.77
8.1.200.0090.00017.53
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0080.00017.62
8.1.160.0070.00021.91
8.1.150.0000.00718.89
8.1.140.0040.00417.48
8.1.130.0000.00717.63
8.1.120.0060.00317.47
8.1.110.0000.00717.48
8.1.100.0040.00417.47
8.1.90.0000.00817.37
8.1.80.0080.00017.50
8.1.70.0070.00017.47
8.1.60.0040.00417.55
8.1.50.0000.00817.54
8.1.40.0000.00817.55
8.1.30.0040.00417.46
8.1.20.0000.00817.60
8.1.10.0000.00717.60
8.1.00.0050.00317.44
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0070.00018.51
8.0.270.0030.00317.30
8.0.260.0000.00717.33
8.0.250.0030.00516.91
8.0.240.0000.00716.91
8.0.230.0030.00317.01
8.0.220.0000.00616.88
8.0.210.0000.00716.88
8.0.200.0040.00416.87
8.0.190.0050.00216.97
8.0.180.0000.00816.91
8.0.170.0040.00416.93
8.0.160.0080.00017.02
8.0.150.0040.00416.74
8.0.140.0000.00816.89
8.0.130.0030.00313.34
8.0.120.0050.00316.75
8.0.110.0000.00816.86
8.0.100.0050.00216.95
8.0.90.0040.00416.78
8.0.80.0040.01516.85
8.0.70.0030.00616.72
8.0.60.0050.00316.74
8.0.50.0070.00016.84
8.0.30.0040.01217.08
8.0.20.0080.01117.40
8.0.10.0050.00216.99
8.0.00.0120.00516.71
7.4.330.0000.00615.14
7.4.320.0030.00316.59
7.4.300.0030.00316.61
7.4.290.0030.00316.63
7.4.280.0030.00516.67
7.4.270.0040.00416.59
7.4.260.0070.00016.59
7.4.250.0060.00316.40
7.4.240.0050.00216.63
7.4.230.0030.00316.69
7.4.220.0090.01016.55
7.4.210.0110.00516.61
7.4.200.0000.00716.50
7.4.160.0030.01316.63
7.4.150.0200.00617.40
7.4.140.0160.00517.86
7.4.130.0070.01116.42
7.4.120.0120.00816.60
7.4.110.0120.00616.54
7.4.100.0160.00716.58
7.4.90.0150.00316.52
7.4.80.0070.01119.39
7.4.70.0100.00716.48
7.4.60.0120.00816.50
7.4.50.0040.00416.25
7.4.40.0130.01016.38
7.4.30.0120.00916.51
7.4.10.0060.01015.17
7.4.00.0060.00915.00
7.3.330.0030.00313.31
7.3.320.0050.00013.34
7.3.310.0000.00716.34
7.3.300.0030.00316.42
7.3.290.0000.00716.25
7.3.280.0100.00816.32
7.3.270.0070.01217.40
7.3.260.0130.00616.57
7.3.250.0110.00816.58
7.3.240.0100.00716.62
7.3.230.0140.00416.50
7.3.210.0110.00716.45
7.3.200.0120.00616.26
7.3.190.0060.01216.61
7.3.180.0000.01516.56
7.3.170.0130.00916.70
7.3.160.0160.00916.57
7.3.130.0090.00915.12
7.3.120.0120.00614.75
7.3.110.0060.01215.13
7.3.100.0100.00715.19
7.3.90.0090.00614.85
7.3.80.0070.00714.62
7.3.70.0110.00414.63
7.3.60.0090.00614.66
7.3.50.0120.00014.68
7.3.40.0030.00615.00
7.3.30.0040.01214.86
7.3.20.0070.00716.73
7.3.10.0140.00016.68
7.3.00.0070.00716.75
7.2.330.0060.01216.45
7.2.320.0130.00316.78
7.2.310.0040.01216.53
7.2.300.0090.00916.54
7.2.290.0070.01016.84
7.2.260.0070.01315.20
7.2.250.0110.00615.16
7.2.240.0090.00615.09
7.2.230.0150.00015.25
7.2.220.0070.00715.09
7.2.210.0070.00715.02
7.2.200.0060.00615.29
7.2.190.0120.00315.19
7.2.180.0030.00615.32
7.2.170.0040.00815.26
7.2.160.0080.00815.03
7.2.150.0070.00417.08
7.2.140.0110.00716.76
7.2.130.0130.00317.08
7.2.120.0090.00616.75
7.2.110.0080.00616.99
7.2.100.0030.01316.90
7.2.90.0030.00916.69
7.2.80.0030.00616.88
7.2.70.0040.01217.14
7.2.60.0030.00816.76
7.2.50.0040.00717.05
7.2.40.0000.01616.93
7.2.30.0030.00616.94
7.2.20.0030.00717.00
7.2.10.0130.01016.83
7.2.00.0110.00518.19
7.1.330.0000.01315.81
7.1.320.0100.00315.84
7.1.310.0030.01015.93
7.1.300.0030.01015.58
7.1.290.0000.01015.74
7.1.280.0030.01015.55
7.1.270.0080.00815.62
7.1.260.0060.00615.80
7.1.250.0030.00915.65
7.1.240.0030.00816.01
7.1.230.0030.01015.80
7.1.220.0070.00715.66
7.1.210.0000.01315.84
7.1.200.0060.00515.80
7.1.190.0070.00715.86
7.1.180.0030.00615.79
7.1.170.0150.00315.58
7.1.160.0030.01015.73
7.1.150.0040.00415.80
7.1.140.0030.01715.59
7.1.130.0090.00615.92
7.1.120.0090.00415.84
7.1.110.0030.00615.97
7.1.100.0050.00916.83
7.1.90.0030.01015.89
7.1.80.0030.01015.85
7.1.70.0050.00816.55
7.1.60.0070.01117.69
7.1.50.0070.01316.49
7.1.40.0120.00315.89
7.1.30.0060.01015.96
7.1.20.0040.00715.68
7.1.10.0030.00515.80
7.1.00.0080.03519.09
7.0.330.0000.01315.38
7.0.320.0040.01115.52
7.0.310.0030.01015.52
7.0.300.0090.00615.49
7.0.290.0030.01015.44
7.0.280.0050.00815.45
7.0.270.0080.00515.46
7.0.260.0060.00615.35
7.0.250.0060.01015.45
7.0.240.0060.00915.45
7.0.230.0030.01315.20
7.0.220.0070.00715.44
7.0.210.0090.00615.63
7.0.200.0080.00515.99
7.0.190.0060.00315.31
7.0.180.0120.00315.47
7.0.170.0030.00715.25
7.0.160.0120.00315.53
7.0.150.0060.00315.53
7.0.140.0070.00715.46
7.0.130.0070.00315.48
7.0.120.0040.01115.35
7.0.110.0000.00815.50
7.0.100.0090.00915.52
7.0.90.0030.00515.44
7.0.80.0030.00715.66
7.0.70.0000.01715.51
7.0.60.0070.02917.75
7.0.50.0000.02716.73
7.0.40.0030.04016.80
7.0.30.0220.04216.80
7.0.20.0180.02316.78
7.0.10.0050.04816.84
7.0.00.0080.04216.81
5.6.400.0040.01114.59
5.6.390.0030.00614.70
5.6.380.0040.01114.37
5.6.370.0000.00914.67
5.6.360.0100.00314.80
5.6.350.0030.00614.64
5.6.340.0040.01114.80
5.6.330.0090.00614.34
5.6.320.0070.01014.63
5.6.310.0000.00914.39
5.6.300.0100.00714.59
5.6.290.0070.00714.79
5.6.280.0050.01817.96
5.6.270.0090.00614.61
5.6.260.0110.00314.62
5.6.250.0100.01014.46
5.6.240.0070.00714.48
5.6.230.0090.00614.54
5.6.220.0060.00914.32
5.6.210.0020.03517.51
5.6.200.0030.04916.41
5.6.190.0050.03717.47
5.6.180.0120.02917.61
5.6.170.0170.02917.42
5.6.160.0040.03417.41
5.6.150.0000.02416.23
5.6.140.0030.02516.25
5.6.130.0100.04216.41
5.6.120.0060.02517.77
5.6.110.0030.03417.87
5.6.100.0080.04217.88
5.6.90.0080.04317.77
5.6.80.0120.02517.31
5.6.70.0170.00014.40
5.6.60.0040.00814.18
5.6.50.0060.00914.51
5.6.40.0030.01014.18
5.6.30.0000.01014.23
5.6.20.0000.01314.48
5.6.10.0060.00614.72
5.6.00.0100.00614.25
5.5.380.0040.00414.28
5.5.370.0040.00814.16
5.5.360.0090.00614.40
5.5.350.0160.02917.43
5.5.340.0060.04616.19
5.5.330.0100.04217.29
5.5.320.0220.03617.36
5.5.310.0130.03217.14
5.5.300.0030.02816.16
5.5.290.0030.04216.11
5.5.280.0070.04417.47
5.5.270.0090.04217.48
5.5.260.0040.04617.60
5.5.250.0100.03817.52
5.5.240.0050.04317.20
5.5.230.0030.00914.34
5.5.220.0000.01113.88
5.5.210.0110.00414.05
5.5.200.0050.00514.13
5.5.190.0090.00914.00
5.5.180.0040.01514.36
5.5.170.0100.00313.87
5.5.160.0120.00414.27
5.5.150.0000.01014.24
5.5.140.0040.01214.22
5.5.130.0040.01214.18
5.5.120.0150.00414.43
5.5.110.0070.01314.45
5.5.100.0160.00414.46
5.5.90.0220.00014.48
5.5.80.0130.01014.01
5.5.70.0040.01714.29
5.5.60.0070.01214.38
5.5.50.0040.01714.37
5.5.40.0060.01414.39
5.5.30.0130.00814.24
5.5.20.0040.01314.38
5.5.10.0040.01714.25
5.5.00.0120.00914.12
5.4.450.0320.03316.19
5.4.440.0420.04216.00
5.4.430.0500.03816.01
5.4.420.0590.03516.15
5.4.410.0460.03316.13
5.4.400.0370.04315.98
5.4.390.0450.03315.99
5.4.380.0480.03015.91
5.4.370.0450.03315.98
5.4.360.0430.03915.92
5.4.350.0370.03015.85
5.4.340.0450.03215.96
5.4.330.0000.01012.70
5.4.320.0530.03516.04
5.4.310.0370.03215.84
5.4.300.0510.03515.92
5.4.290.0350.03515.92
5.4.280.0390.02716.03
5.4.270.0340.02915.77
5.4.260.0200.03016.05
5.4.250.0220.03515.98
5.4.240.0470.02415.96
5.4.230.0390.03315.98
5.4.220.0380.03215.83
5.4.210.0440.03015.85
5.4.200.0350.03014.75
5.4.190.0270.02815.89
5.4.180.0100.03315.93
5.4.170.0400.04415.91
5.4.160.0290.02615.85
5.4.150.0220.02915.83
5.4.140.0370.03714.63
5.4.130.0450.02914.61
5.4.120.0230.03014.49
5.4.110.0250.03114.63
5.4.100.0430.03614.55
5.4.90.0430.03214.52
5.4.80.0350.04414.56
5.4.70.0480.03314.61
5.4.60.0380.03814.69
5.4.50.0640.03314.57
5.4.40.0470.04614.59
5.4.30.0550.03614.61
5.4.20.0540.03714.54
5.4.10.0390.03714.60
5.4.00.0420.03114.33
5.3.290.0830.06014.59
5.3.280.0800.07314.65
5.3.270.0930.06014.60
5.3.260.0930.05014.52
5.3.250.0530.06014.83
5.3.240.0730.05314.49
5.3.230.0830.06014.52
5.3.220.0830.05314.63
5.3.210.0830.06314.49
5.3.200.0800.05014.54
5.3.190.0730.05714.47
5.3.180.0570.06714.65
5.3.170.0930.06314.62
5.3.160.1100.07014.48
5.3.150.1500.06714.81
5.3.140.1030.06714.39
5.3.130.1170.04314.45
5.3.120.0800.07014.56
5.3.110.0630.06714.77
5.3.100.0600.05714.06
5.3.90.1000.04713.99
5.3.80.0870.05314.04
5.3.70.0870.05713.92
5.3.60.0970.04713.92
5.3.50.0770.04713.86
5.3.40.1030.05713.97
5.3.30.1030.05713.77
5.3.20.1030.05313.84
5.3.10.0870.05013.55
5.3.00.1000.05313.66
5.2.170.0800.04711.16
5.2.160.0800.05711.21
5.2.150.0570.05711.16
5.2.140.0100.05711.17
5.2.130.0130.04011.17
5.2.120.0870.05011.20
5.2.110.0700.04311.11
5.2.100.0730.03311.25
5.2.90.0300.04011.00
5.2.80.0030.04711.00
5.2.70.0700.04311.18
5.2.60.0770.04310.96
5.2.50.0800.05311.06
5.2.40.0530.03710.91
5.2.30.0600.04311.06
5.2.20.0600.04711.18
5.2.10.0500.04710.79
5.2.00.0530.04010.68
5.1.60.0070.0379.98
5.1.50.0030.03710.01
5.1.40.0500.0409.83
5.1.30.0400.03310.25
5.1.20.0570.03010.27
5.1.10.0600.03010.15
5.1.00.0630.04010.06
5.0.50.0200.0378.61
5.0.40.0270.0278.36
5.0.30.0400.0408.18
5.0.20.0230.0308.30
5.0.10.0270.0308.08
5.0.00.0230.0608.15
4.4.90.0230.0275.89
4.4.80.0270.0205.84
4.4.70.0230.0205.81
4.4.60.0300.0205.90
4.4.50.0330.0235.86
4.4.40.0200.0435.89
4.4.30.0270.0275.87
4.4.20.0270.0275.87
4.4.10.0370.0135.84
4.4.00.0200.0335.81
4.3.110.0270.0275.82
4.3.100.0300.0235.70
4.3.90.0330.0205.68
4.3.80.0270.0375.72
4.3.70.0270.0275.75
4.3.60.0330.0175.73
4.3.50.0230.0235.77
4.3.40.0370.0335.64
4.3.30.0100.0234.54
4.3.20.0130.0234.55
4.3.10.0070.0234.45
4.3.00.0130.0208.54

preferences:
69.39 ms | 401 KiB | 5 Q