3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-type: text/plain"); //period=68 for month, period=67 for weekly, period=56 for daily, only for html $stock="2888"; $arrCSV = array(); $url = "http://chartdata1.internet.aastocks.com/servlet/iDataServlet/getdaily?id=".$stock.".HK&type=24&market=1&level=1&period=56&encoding=big5"; $html = file_get_contents($url); $c = str_replace("|","\r\n",$html); $d = str_replace(";",",",$c); $pos = substr_count($d,'!'); if ($pos == 1){ $file = strstr($d,'!',true); }else{ $file = str_replace("!","\r\n",$d); } { $key = 1; $row = str_getcsv($file, "\n"); $length = count($row); for($i=2;$i<$length;$i++) { $data = str_getcsv($row[$i], ","); //echo '<br/>======<br/>'; //print_r($data); $c = count($data); //print $c . "<BR>"; // <------ 7 o numero de colunas //Populate the array If ($key != 0) { $arrCSV[$key-1][0] = strtotime($data[0]); //Time $arrCSV[$key-1][1] = $data[1]; //Open $arrCSV[$key-1][2] = $data[2]; //High $arrCSV[$key-1][3] = $data[3]; //Low $arrCSV[$key-1][4] = $data[4]; //Adj Close $arrCSV[$key-1][5] = $data[5]*1000; //Volume $arrCSV[$key-1][6] = $data[6]; //Volume1 } $key++; } // end while $keymax = $key; // Close the CSV file } // end if $key = 1; rsort ($arrCSV); foreach($arrCSV as $index => $data) { //echo '<br/>======<br/>'; //print_r($data); $c = count($data); //print $c . "<BR>"; // <------ 6 numero de colunas If ($key != 0) { $arrCSV[$key-1][0] = date('d-m-Y',$data[0]); //Time $arrCSV[$key-1][1] = floatval($data[1]); //Open $arrCSV[$key-1][2] = floatval($data[2]); //High $arrCSV[$key-1][3] = floatval($data[3]); //Low $arrCSV[$key-1][4] = floatval($data[4]); //Close $arrCSV[$key-1][5] = floatval($data[5]); //Volume $arrCSV[$key-1][6] = floatval($data[6]); //Volume1 } //echo '<Br/>'; //print_r($arrCSV[$key-1]); $key++; } // end while $keymax = $key; $a = json_encode($arrCSV,JSON_NUMERIC_CHECK); $b = str_replace('],["',"\r\n",$a); $c = str_replace('",',',',$b); $file = trim($c,'[["]]'); echo "<html><body><table>\n\n"; $row = str_getcsv($file, "\n"); $length = count($row); for($i=0;$i<$length;$i++) { $line = str_getcsv($row[$i], ","); foreach ($line as $cell) { echo "<td>" . htmlspecialchars($cell) . "</td>"; } echo "</tr>\n"; } echo "\n</table></body></html>"; header("Content-type: application/html"); header("Content-disposition: attachment; filename=".$stock."_AA.html"); ?>

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.01118.32
8.3.50.0130.00821.31
8.3.40.0120.00319.09
8.3.30.0110.00419.17
8.3.20.0050.00320.67
8.3.10.0080.00021.04
8.3.00.0050.00320.95
8.2.180.0070.01117.00
8.2.170.0080.00822.96
8.2.160.0090.00619.70
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0080.00019.61
8.2.120.0030.00526.35
8.2.110.0050.00522.50
8.2.100.0110.00021.12
8.2.90.0080.00019.34
8.2.80.0060.00318.13
8.2.70.0080.00018.00
8.2.60.0040.00418.30
8.2.50.0000.00818.09
8.2.40.0050.00320.80
8.2.30.0000.00719.74
8.2.20.0040.00418.17
8.2.10.0000.00818.35
8.2.00.0030.00618.41
8.1.280.0130.00325.92
8.1.270.0080.00023.86
8.1.260.0050.00328.09
8.1.250.0100.01028.09
8.1.240.0030.00624.09
8.1.230.0080.00419.39
8.1.220.0050.00318.16
8.1.210.0050.00518.77
8.1.200.0100.00017.60
8.1.190.0000.00817.25
8.1.180.0040.00418.10
8.1.170.0030.00618.84
8.1.160.0040.00421.17
8.1.150.0050.00319.16
8.1.140.0050.00319.82
8.1.130.0000.00818.02
8.1.120.0040.00417.71
8.1.110.0030.00617.66
8.1.100.0000.00717.68
8.1.90.0030.00617.88
8.1.80.0000.00817.73
8.1.70.0040.00417.89
8.1.60.0030.00617.82
8.1.50.0050.00517.74
8.1.40.0040.00417.67
8.1.30.0000.00918.04
8.1.20.0050.00317.88
8.1.10.0000.00817.81
8.1.00.0000.00817.61
8.0.300.0080.00018.77
8.0.290.0040.00417.25
8.0.280.0040.00418.82
8.0.270.0000.00817.63
8.0.260.0070.00017.70
8.0.250.0000.00717.29
8.0.240.0040.00417.21
8.0.230.0080.00017.30
8.0.220.0000.00717.23
8.0.210.0030.00617.26
8.0.200.0030.00317.19
8.0.190.0040.00417.39
8.0.180.0090.00017.27
8.0.170.0000.00817.29
8.0.160.0040.00317.31
8.0.150.0000.00817.30
8.0.140.0020.00517.21
8.0.130.0030.00313.90
8.0.120.0050.00317.28
8.0.110.0000.00817.38
8.0.100.0040.00417.19
8.0.90.0040.00417.25
8.0.80.0070.01317.29
8.0.70.0050.00517.25
8.0.60.0050.00317.32
8.0.50.0000.00817.25
8.0.30.0080.01017.44
8.0.20.0110.01317.46
8.0.10.0030.00617.36
8.0.00.0190.00517.09
7.4.330.0030.00316.98
7.4.320.0070.00016.75
7.4.300.0060.00016.80
7.4.290.0070.00016.85
7.4.280.0040.00416.80
7.4.270.0070.00016.73
7.4.260.0040.00416.70
7.4.250.0040.00416.77
7.4.240.0000.00816.96
7.4.230.0000.00716.68
7.4.220.0090.01216.81
7.4.210.0030.01316.98
7.4.200.0050.00316.89
7.4.160.0150.00916.76
7.4.150.0180.00917.40
7.4.140.0150.01717.86
7.4.130.0120.01016.89
7.4.120.0100.01016.98
7.4.110.0090.00916.97
7.4.100.0100.01716.87
7.4.90.0120.00616.93
7.4.80.0150.00919.39
7.4.70.0090.00916.85
7.4.60.0040.01416.99
7.4.50.0030.01016.73
7.4.40.0110.00716.80
7.4.30.0060.01216.85
7.4.00.0060.01215.48
7.3.330.0000.00513.81
7.3.320.0050.00013.80
7.3.310.0040.00416.93
7.3.300.0060.00316.74
7.3.290.0120.00716.85
7.3.280.0090.01016.84
7.3.270.0140.01017.40
7.3.260.0060.01316.73
7.3.250.0120.00916.94
7.3.240.0120.00716.87
7.3.230.0140.00316.96
7.3.210.0140.00716.77
7.3.200.0140.00316.89
7.3.190.0040.01416.88
7.3.180.0140.00316.93
7.3.170.0160.00816.94
7.3.160.0100.00616.79
7.3.120.0040.01415.27
7.3.110.0070.00715.08
7.3.100.0030.00614.86
7.3.90.0030.01015.36
7.3.80.0030.01315.37
7.3.70.0070.00714.87
7.3.60.0030.00915.27
7.3.50.0070.01015.28
7.3.40.0100.00715.08
7.3.30.0070.01015.27
7.3.20.0160.00317.01
7.3.10.0070.00716.50
7.3.00.0100.00616.69
7.2.330.0190.00317.18
7.2.320.0120.00916.82
7.2.310.0160.00717.13
7.2.300.0090.00916.98
7.2.290.0040.01217.20
7.2.240.0000.01015.43
7.2.230.0130.00315.52
7.2.220.0000.01415.54
7.2.210.0070.01115.57
7.2.200.0090.00915.59
7.2.190.0030.01215.48
7.2.180.0070.01115.10
7.2.170.0000.01415.48
7.2.160.0030.01015.55
7.2.150.0080.00417.32
7.2.140.0060.00616.99
7.2.130.0180.00017.13
7.2.120.0080.01017.04
7.2.110.0080.01016.95
7.2.100.0080.00817.05
7.2.90.0020.01416.86
7.2.80.0080.00917.12
7.2.70.0100.00516.79
7.2.60.0100.00917.30
7.2.50.0070.00617.19
7.2.40.0100.01016.96
7.2.30.0030.01217.08
7.2.20.0110.00517.22
7.2.10.0090.00617.01
7.2.00.0050.00918.01
7.1.330.0070.00716.21
7.1.320.0030.00816.15
7.1.310.0060.00915.69
7.1.300.0000.01316.18
7.1.290.0090.00616.12
7.1.280.0090.00616.14
7.1.270.0040.01516.13
7.1.260.0130.00315.92
7.1.250.0080.00615.91
7.1.200.0060.00716.17
7.1.70.0000.01017.59
7.1.60.0060.01919.19
7.1.50.0210.00635.09
7.1.00.0000.08022.66
7.0.200.0170.00017.23
7.0.100.0300.07720.50
7.0.90.0270.07320.49
7.0.80.0170.06020.41
7.0.70.0400.07020.33
7.0.60.0370.07720.32
7.0.50.0300.06320.70
7.0.40.0070.08320.41
7.0.30.0030.04320.43
7.0.20.0030.08020.52
7.0.10.0030.05720.52
7.0.00.0170.07720.54
5.6.250.0030.09021.22
5.6.240.0070.08021.20
5.6.230.0130.07321.02
5.6.220.0130.05320.94
5.6.210.0130.07720.77
5.6.200.0100.08321.40
5.6.190.0130.07021.45
5.6.180.0100.08321.55
5.6.170.0130.07321.41
5.6.160.0100.08321.61
5.6.150.0030.04721.27
5.6.140.0100.05721.47
5.6.130.0100.08321.60
5.6.120.0030.09021.51
5.6.110.0030.08321.32
5.6.100.0130.07321.46
5.6.90.0100.08321.42
5.6.80.0100.06720.77
5.6.70.0100.07720.93
5.6.60.0170.07320.91
5.6.50.0070.07020.83
5.6.40.0100.07720.90
5.6.30.0030.07320.86
5.6.20.0100.07320.93
5.6.10.0000.08720.77
5.6.00.0000.07320.59
5.5.380.0070.07720.70
5.5.370.0070.08020.83
5.5.360.0030.07320.62
5.5.350.0030.08320.68
5.5.340.0200.07321.23
5.5.330.0070.07721.23
5.5.320.0070.05021.36
5.5.310.0030.06721.04
5.5.300.0070.07021.23
5.5.290.0070.04321.35
5.5.280.0130.08021.33
5.5.270.0070.07021.04
5.5.260.0130.07021.29
5.5.250.0170.07020.88
5.5.240.0130.07320.61
5.5.230.0030.07020.73
5.5.220.0030.06720.62
5.5.210.0070.08320.54
5.5.200.0070.07720.55
5.5.190.0070.07720.56
5.5.180.0000.08720.59
5.5.160.0130.07320.59
5.5.150.0100.08020.64
5.5.140.0030.07320.53
5.5.130.0030.06720.55
5.5.120.0030.06720.36
5.5.110.0100.07020.54
5.5.100.0070.08320.49
5.5.90.0030.08320.47
5.5.80.0170.06720.45
5.5.70.0100.05720.53
5.5.60.0170.06320.43
5.5.50.0100.07320.58
5.5.40.0100.06320.34
5.5.30.0170.05720.43
5.5.20.0070.08320.30
5.5.10.0030.08720.35
5.5.00.0000.07720.46

preferences:
61.76 ms | 401 KiB | 5 Q