3v4l.org

run code in 300+ PHP versions simultaneously
<!-- IN THIS EXAMPLE, WE WILL SHOW THE DAILY WEATHER FORECAST FOR 7 DAYS THAT GIVES THE XML FILE 1 FOR LONDON, Here we will recover the XML file path to the desired location through an online form, but may directly indicate in the code through a variable as $file = "http://api.tiempo.com/index.php?api_lang=en&affiliate_id=..." --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <link href="./styles.css" rel="stylesheet" type="text/css" /> </head> <body> <FORM METHOD="post"> <font face="arial">Enter the URL path: </font><input type="text" name="file" size="60" ><br><br> <input type="submit" value="Submit" style="height:50px; width:100px; font-size:14px;"> </FORM> <?php $var1 = array(0=>"Temp min."); $var2 = array(0=>"Temp max."); $var3 = array(0=>"Wind."); $var4 = array(0=>"Symbol."); $var5 = array(0=>"Day."); $array = array(); //if (!empty($_POST['file'])) echo 'fichero lleno'; //else echo 'fichero vacio'; if (isset($_POST['file']) and (!empty($_POST['file']))) { $file = $_POST['file']; // We recover the file data to treat if($xml = simplexml_load_file($file)){ $i=0; $nday=7; // Here is the forecast for 7 days $url= $xml->location->interesting->url; $array=explode('-', $url); foreach ($xml->location->var as $var) { switch ($i) { case 0: $j=0; for($j=0; $j<$nday; $j++){$var1 = $var1 + array($j+1=>htmlentities($xml->location->var[$i]->data->forecast[$j]->attributes()->value,ENT_COMPAT,'UTF-8'));} break; case 1: $j=0; for($j=0; $j<$nday; $j++){$var2 = $var2 + array($j+1=>htmlentities($xml->location->var[$i]->data->forecast[$j]->attributes()->value,ENT_COMPAT,'UTF-8'));} break; case 2: $j=0; for($j=0; $j<$nday; $j++){$var3 = $var3 + array($j+1=>htmlentities($xml->location->var[$i]->data->forecast[$j]->attributes()->value,ENT_COMPAT,'UTF-8'));} break; case 3: $j=0; for($j=0; $j<$nday; $j++){$var4 = $var4 + array($j+1=>htmlentities($xml->location->var[$i]->data->forecast[$j]->attributes()->value,ENT_COMPAT,'UTF-8'));} break; case 4: $j=0; for($j=0; $j<$nday; $j++){$var5 = $var5 + array($j+1=>htmlentities($xml->location->var[$i]->data->forecast[$j]->attributes()->value,ENT_COMPAT,'UTF-8'));} break; }//switch $i++; }//foreach }//if else { echo "Enter the URL path of the XML file"; } //We will build a table to display the results $i=1; echo '<br><br>'; echo '<table height="240px" width="635px" class="table_background">'; echo '<tr>'; echo '<th colspan="7">'; echo 'Forecasts for '.$array[3]; echo '</th>'; echo '</tr>'; echo '<tr>'; for($i=1; $i<$nday+1; $i++){ echo '<td>'; echo'<table height="195px" width="80px" class="file_background">'; echo'<tr>'; echo '<th>'; echo " ".$var5[$i]; echo '</th>'; echo '</tr>'; if (isset($var4[$i])){ echo '<tr>'; echo '<td align="center">'; if ($var4[$i] == "Sunny") {echo " <img src='./images/weather/1.gif' alt='Sunny' title='Sunny'/><BR>";} if ($var4[$i] == "Cloudy Intervals"){echo " <img src='./images/weather/2.gif' alt ='Cloudy Intervals' title='Cloudy Intervals'/><BR>";} if ($var4[$i] == "Cloudy Skies") {echo " <img src='./images/weather/3.gif' alt = 'Cloudy Skies' title='Cloudy Skies'/><BR>";} if ($var4[$i] == "Overcast") {echo " <img src='./images/weather/4.gif' alt = 'Overcast' title='Overcast'/><BR>";} if ($var4[$i] == "Cloudy intervals with light rain") {echo " <img src='./images/weather/5.gif' alt='Cloudy intervals with light rain' title='Cloudy intervals with light rain'/><BR>";} if ($var4[$i] == "Cloudy with light rain") {echo " <img src='./images/weather/6.gif' alt='Cloudy with light rain title='Cloudy with light rain'/><BR>";} if ($var4[$i] == "Overcast with light rain") {echo " <img src='./images/weather/7.gif' alt='Overcast with light rain' title='Overcast with light rain'/><BR>";} if ($var4[$i] == "Cloudy intervals with moderate rain") {echo " <img src='./images/weather/8.gif' alt='Cloudy intervals with moderate rain' title='Cloudy intervals with moderate rain'/><BR>";} if ($var4[$i] == "Cloudy with moderate rain") {echo " <img src='./images/weather/9.gif' alt='Cloudy with moderate rain' title='Cloudy with moderate rain'/><BR>";} if ($var4[$i] == "Overcast with moderate rain") {echo " <img src='./images/weather/10.gif' alt='Overcast with moderate rain' title='Overcast with moderate rain'/><BR>";} if ($var4[$i] == "Cloudy intervals with thunderstorms") {echo " <img src='./images/weather/11.gif' alt='Cloudy intervals with thunderstorms' title='Cloudy intervals with thunderstorms'/><BR>";} if ($var4[$i] == "Cloudy with thunderstorms") {echo " <img src='./images/weather/12.gif' alt='Cloudy with thunderstorms' title='Cloudy with thunderstorms'/><BR>";} if ($var4[$i] == "Overcast with thunderstorms") {echo " <img src='./images/weather/13.gif' alt='Overcast with thunderstorms' title='Overcast with thunderstorms'/><BR>";} if ($var4[$i] == "Cloudy intervals, thunderstorms and hail") {echo " <img src='./images/weather/14.gif' alt='Cloudy intervals, thunderstorms and hail' title='Cloudy intervals, thunderstorms and hail'/><BR>";} if ($var4[$i] == "Cloudy, thunderstorms and hail") {echo " <img src='./images/weather/15.gif' alt='Cloudy, thunderstorms and hail' title='Cloudy, thunderstorms and hail'/><BR>";} if ($var4[$i] == "Overcast, thunderstorms and hail"){echo " <img src='./images/weather/16.gif' alt ='Overcast, thunderstorms and hail' title='Overcast, thunderstorms and hailo'/><BR>";} if ($var4[$i] == "Cloudy intervals and snow") {echo " <img src='./images/weather/17.gif' alt='Cloudy intervals and snow' title='Cloudy intervals and snow'/><BR>";} if ($var4[$i] == "Cloudy and snow"){echo " <img src='./images/weather/18.gif' alt='Cloudy and snow' title='Cloudy and snow'/><BR>";} if ($var4[$i] == "Overcast an snow"){echo " <img src='./images/weather/19.gif' alt='Overcast an snow' title='Overcast an snow'/><BR>";} echo '</td>'; echo '</tr>'; } //fi if $var4[$i] //echo '</tr>'; echo '<tr>'; echo '<th>'; echo " Min ".$var1[$i]; echo '</th>'; echo '</tr>'; echo '<tr>'; echo '<th>'; echo " Max ".$var2[$i]; echo '</th>'; echo '</tr>'; if (isset($var3[$i])){ echo '<tr>'; echo '<td align="center">'; if ($var3[$i] == "Light N wind") {echo " <img src='./images/wind/WindN.png' alt='Light N Wind' title='Light N Wind'/><BR>";} if ($var3[$i] == "Light NE wind") {echo " <img src='./images/wind/WindNE.png' alt='Light NE wind' title='Light NE wind'/><BR>";} if ($var3[$i] == "Light E wind") {echo " <img src='./images/wind/WindE.png' alt='Light E wind' title='Light E wind'/><BR>";} if ($var3[$i] == "Light SE wind") {echo " <img src='./images/wind/WindSE.png' alt='Light SE wind' title='Light SE wind'/><BR>";} if ($var3[$i] == "Light S wind") {echo " <img src='./images/wind/WindS.png' alt='Light S wind' title='Light S wind'/><BR>";} if ($var3[$i] == "Light SW wind") {echo " <img src='./images/wind/WindSW.png' alt='Light SW wind' title='Light SW wind'/><BR>";} if ($var3[$i] == "Light W wind") {echo " <img src='./images/wind/WindW.png' alt='Light W wind' title='Light W wind'/><BR>";} if ($var3[$i] == "Light NW wind") {echo " <img src='./images/wind/WindNW.png' alt='Light NW wind' title='Light NW wind'/><BR>";} if ($var3[$i] == "Moderate N wind") {echo " <img src='./images/wind/WindN.png' alt='Moderate N wind' title='Moderate N wind'/><BR>";} if ($var3[$i] == "Moderate NE wind") {echo " <img src='./images/wind/WindNE.png' alt='Moderate NE wind' title='Moderate NE wind'/><BR>";} if ($var3[$i] == "Moderate E wind") {echo "<img src='./images/wind/WindE.png' alt='Moderate E wind' title='Moderate E wind'/><BR>";} if ($var3[$i] == "Moderate SE wind") {echo " <img src='./images/wind/WindSE.png' alt='Moderate SE wind' title='Moderate SE wind'/><BR>";} if ($var3[$i] == "Moderate S wind") {echo " <img src='./images/wind/WindS.png' alt='Moderate S wind' title='Moderate S wind'/><BR>";} if ($var3[$i] == "Moderate SW wind") {echo " <img src='./images/wind/WindSW.png' alt='Moderate SW wind' title='Moderate SW wind'/><BR>";} if ($var3[$i] == "Moderate W wind") {echo " <img src='./images/wind/WindW.png' alt='Moderate W wind' title='Moderate W wind'/><BR>";} if ($var3[$i] == "Moderate NW wind") {echo " <img src='./images/wind/WindNW.png' alt='Moderate NW wind' title='Moderate NW wind'/><BR>";} if ($var3[$i] == "Wind N wind") {echo " <img src='./images/wind/WindN.png' alt='Wind N wind' title='Wind N wind'/><BR>";} if ($var3[$i] == "Wind NE wind") {echo " <img src='./images/wind/WindNE.png' alt='Wind NE wind' title='Wind NE wind'/><BR>";} if ($var3[$i] == "Wind E wind") {echo " <img src='./images/wind/WindE.png' alt='Wind E wind' title='Wind E wind'/><BR>";} if ($var3[$i] == "Wind SE wind") {echo " <img src='./images/wind/WindSE.png' alt='Wind SE wind' title='Wind SE wind'/><BR>";} if ($var3[$i] == "Wind S wind") {echo " <img src='./images/wind/WindS.png' alt='Wind S wind' title='Wind S wind'/><BR>";} if ($var3[$i] == "Wind SW wind") {echo " <img src='./images/wind/WindSW.png' alt='Wind SW wind' title='Wind SW wind'/><BR>";} if ($var3[$i] == "Wind W wind") {echo " <img src='./images/wind/WindW.png' alt='Wind W wind' title='Wind W wind'/><BR>";} if ($var3[$i] == "Wind NW wind") {echo " <img src='./images/wind/WindNW.png' alt='Wind NW wind' title='Wind NW wind'/><BR>";} if ($var3[$i] == "Strong N wind") {echo " <img src='./images/wind/WindN.png' alt='Strong N wind' title='Strong N wind'/><BR>";} if ($var3[$i] == "Strong NE wind") {echo " <img src='./images/wind/WindNE.png' alt='Strong NE wind' title='Strong NE wind'/><BR>";} if ($var3[$i] == "Strong E wind") {echo " <img src='./images/wind/WindE.png' alt='Strong E wind' title='Strong E wind'/><BR>";} if ($var3[$i] == "Strong SE wind") {echo " <img src='./images/wind/WindSE.png' alt='Strong SE wind' title='Strong SE wind'/><BR>";} if ($var3[$i] == "Strong S wind") {echo " <img src='./images/wind/WindS.png ' alt='Strong S wind' title='Strong S wind'/><BR>";} if ($var3[$i] == "Strong SW wind") {echo " <img src='./images/wind/WindSW.png' alt='Strong SW wind' title='Strong SW wind'/><BR>";} if ($var3[$i] == "Strong W wind") {echo " <img src='./images/wind/WindW.png' alt='Strong W wind' title='Strong W wind'/><BR>";} if ($var3[$i] == "Strong NW wind") {echo " <img src='./images/wind/WindNW.png' alt='Strong NW wind' title='Strong NW wind'/><BR>";} if ($var3[$i] == "Variable wind") {echo " <img src='./images/wind/Variablewind.gif' alt='Variable wind' title='Variable wind'/><BR>";} echo '</td>'; echo '</tr>'; echo '</table>'; echo '</td>'; }//fin if $var3 } echo '</tr>'; echo '<tr>'; echo '<th colspan="7">'; echo 'www.tiempo.com'; echo '</th>'; echo '</table>'; } ?> </body> </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.0150.00318.18
8.3.50.0140.00522.12
8.3.40.0110.00718.96
8.3.30.0130.00319.36
8.3.20.0050.00320.37
8.3.10.0050.00323.53
8.3.00.0030.00719.25
8.2.180.0170.00016.38
8.2.170.0110.00422.96
8.2.160.0070.00720.70
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0000.00722.19
8.2.110.0030.00620.61
8.2.100.0040.00818.16
8.2.90.0060.00319.16
8.2.80.0030.00517.97
8.2.70.0060.00617.63
8.2.60.0000.01218.16
8.2.50.0040.00518.07
8.2.40.0040.00419.73
8.2.30.0080.00018.27
8.2.20.0080.00017.79
8.2.10.0000.00718.23
8.2.00.0050.00317.79
8.1.280.0160.00325.92
8.1.270.0040.00423.91
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00323.79
8.1.230.0060.00619.11
8.1.220.0000.00817.78
8.1.210.0040.00418.77
8.1.200.0000.00917.25
8.1.190.0000.00817.25
8.1.180.0050.00318.10
8.1.170.0000.00818.72
8.1.160.0040.00422.11
8.1.150.0030.00519.06
8.1.140.0020.00517.66
8.1.130.0090.00019.66
8.1.120.0030.00517.64
8.1.110.0040.00417.53
8.1.100.0000.00717.54
8.1.90.0050.00217.49
8.1.80.0000.00717.67
8.1.70.0050.00317.45
8.1.60.0040.00417.75
8.1.50.0040.00417.52
8.1.40.0000.00917.66
8.1.30.0040.00417.71
8.1.20.0050.00317.78
8.1.10.0020.00517.73
8.1.00.0040.00417.64
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0020.00518.52
8.0.270.0050.00217.34
8.0.260.0000.00717.30
8.0.250.0070.00017.09
8.0.240.0040.00416.96
8.0.230.0030.00317.05
8.0.220.0040.00417.07
8.0.210.0030.00316.98
8.0.200.0030.00317.01
8.0.190.0000.00817.03
8.0.180.0040.00417.09
8.0.170.0000.00817.01
8.0.160.0000.00717.11
8.0.150.0070.00017.02
8.0.140.0030.00617.01
8.0.130.0000.00613.55
8.0.120.0040.00417.06
8.0.110.0000.00717.03
8.0.100.0030.00517.10
8.0.90.0040.00416.96
8.0.80.0090.00917.14
8.0.70.0020.00517.13
8.0.60.0040.00417.04
8.0.50.0040.00416.90
8.0.30.0150.00717.31
8.0.20.0160.00517.40
8.0.10.0060.00317.09
8.0.00.0100.00716.87
7.4.330.0020.00215.00
7.4.320.0070.00016.72
7.4.300.0040.00416.66
7.4.290.0040.00416.68
7.4.280.0000.00716.76
7.4.270.0000.00716.66
7.4.260.0070.00016.75
7.4.250.0080.00016.78
7.4.240.0020.00516.65
7.4.230.0000.00716.57
7.4.220.0110.00916.69
7.4.210.0070.00716.77
7.4.200.0050.00216.61
7.4.160.0040.01216.56
7.4.150.0150.00317.40
7.4.140.0130.00817.86
7.4.130.0120.00716.70
7.4.120.0100.00816.68
7.4.110.0120.01216.56
7.4.100.0070.01016.55
7.4.90.0080.01216.71
7.4.80.0120.00619.39
7.4.70.0120.00916.61
7.4.60.0120.00316.56
7.4.50.0000.00416.70
7.4.40.0080.01216.70
7.4.30.0070.01016.47
7.4.00.0090.01014.98
7.3.330.0040.00413.23
7.3.320.0030.00313.30
7.3.310.0040.00416.36
7.3.300.0000.00716.46
7.3.290.0110.00316.34
7.3.280.0090.00816.35
7.3.270.0100.01017.40
7.3.260.0080.00816.42
7.3.250.0130.01016.36
7.3.240.0170.00416.59
7.3.230.0070.01116.39
7.3.210.0040.01416.46
7.3.200.0110.00719.39
7.3.190.0090.01016.67
7.3.180.0080.00816.33
7.3.170.0100.00716.48
7.3.160.0100.01016.60
7.3.120.0100.01014.86
7.3.110.0060.00915.11
7.3.100.0000.01614.73
7.3.90.0080.00314.56
7.3.80.0000.01514.96
7.3.70.0000.01314.60
7.3.60.0000.01214.71
7.3.50.0060.00614.80
7.3.40.0030.01014.82
7.3.30.0040.00814.67
7.3.20.0070.00416.55
7.3.10.0110.00316.57
7.3.00.0070.00716.57
7.2.330.0120.00916.58
7.2.320.0160.01016.52
7.2.310.0180.00616.54
7.2.300.0090.00916.52
7.2.290.0100.01316.82
7.2.250.0070.01115.21
7.2.240.0060.01214.64
7.2.230.0090.00314.66
7.2.220.0120.00014.99
7.2.210.0060.00915.28
7.2.200.0060.00915.24
7.2.190.0100.00315.02
7.2.180.0110.00414.76
7.2.170.0060.00615.00
7.2.00.0000.01319.36
7.1.330.0040.01115.68
7.1.320.0070.00715.70
7.1.310.0030.00615.69
7.1.300.0030.01315.61
7.1.290.0030.00615.62
7.1.280.0000.01315.57
7.1.270.0130.00015.60
7.1.260.0090.00315.63
7.1.100.0080.00417.12
7.1.70.0080.00316.90
7.1.60.0100.01419.32
7.1.50.0000.01116.80
7.1.00.0030.07722.54
7.0.200.0000.00916.57
7.0.140.0000.07721.92
7.0.100.0000.07020.15
7.0.90.0070.07319.96
7.0.80.0070.08320.06
7.0.70.0100.08319.99
7.0.60.0130.08020.16
7.0.50.0030.08720.44
7.0.40.0130.08020.13
7.0.30.0030.09019.91
7.0.20.0200.05020.05
7.0.10.0170.06320.00
7.0.00.0100.06320.02
5.6.280.0070.07020.93
5.6.250.0100.08320.59
5.6.240.0100.08020.57
5.6.230.0070.07320.62
5.6.220.0070.08720.60
5.6.210.0100.04720.58
5.6.200.0200.06721.02
5.6.190.0100.08021.07
5.6.180.0070.08321.05
5.6.170.0100.07720.96
5.6.160.0070.08021.10
5.6.150.0070.09021.13
5.6.140.0030.08320.93
5.6.130.0130.07320.95
5.6.120.0070.06021.08
5.6.110.0130.07721.11
5.6.100.0070.07320.96
5.6.90.0070.08321.04
5.6.80.0170.05020.43
5.6.70.0100.07320.50
5.6.60.0100.04320.48
5.6.50.0070.07020.44
5.6.40.0100.07320.38
5.6.30.0100.07720.40
5.6.20.0200.06720.45
5.6.10.0100.07320.51
5.6.00.0070.07320.50
5.5.380.0130.07020.38
5.5.370.0170.07320.37
5.5.360.0100.07020.57
5.5.350.0070.08320.39
5.5.340.0130.07720.79
5.5.330.0030.07320.90
5.5.320.0100.07720.86
5.5.310.0130.07320.95
5.5.300.0100.07320.92
5.5.290.0100.08020.89
5.5.280.0170.07720.79
5.5.270.0130.07020.66
5.5.260.0130.06720.75
5.5.250.0130.07720.67
5.5.240.0000.08720.23
5.5.230.0100.07720.25
5.5.220.0170.06320.20
5.5.210.0070.07720.16
5.5.200.0100.06320.25
5.5.190.0130.07320.17
5.5.180.0100.08020.26
5.5.160.0030.08320.25
5.5.150.0030.08020.14
5.5.140.0300.05320.16
5.5.130.0130.08020.17
5.5.120.0070.07720.27
5.5.110.0030.07720.14
5.5.100.0000.06320.18
5.5.90.0030.06720.17
5.5.80.0070.07720.12
5.5.70.0030.08320.14
5.5.60.0030.05320.17
5.5.50.0030.08020.02
5.5.40.0130.06719.95
5.5.30.0000.07720.15
5.5.20.0000.08720.07
5.5.10.0030.07320.14
5.5.00.0070.07319.96
5.4.450.0130.06319.44
5.4.440.0070.07319.40
5.4.430.0070.08319.48
5.4.420.0170.07319.30
5.4.410.0100.06319.29
5.4.400.0130.07019.12
5.4.390.0100.07719.06
5.4.380.0030.07718.98
5.4.370.0100.05719.10
5.4.360.0070.05019.23
5.4.350.0070.07019.09
5.4.340.0070.08018.80
5.4.320.0100.07318.98
5.4.310.0070.05319.11
5.4.300.0130.06719.02
5.4.290.0000.06319.15
5.4.280.0070.07719.23
5.4.270.0070.05318.97
5.4.260.0100.07019.02
5.4.250.0100.07019.05
5.4.240.0070.07719.09
5.4.230.0100.06319.00
5.4.220.0130.06719.05
5.4.210.0170.06319.05
5.4.200.0130.06719.13
5.4.190.0030.08019.01
5.4.180.0030.06019.21
5.4.170.0030.07719.11
5.4.160.0100.07018.96
5.4.150.0070.07719.04
5.4.140.0130.07316.36
5.4.130.0070.07316.28
5.4.120.0000.04316.29
5.4.110.0100.07016.44
5.4.100.0070.06716.46
5.4.90.0070.07716.38
5.4.80.0070.06716.48
5.4.70.0100.06716.34
5.4.60.0170.06016.46
5.4.50.0030.07016.34
5.4.40.0030.03716.25
5.4.30.0170.06316.39
5.4.20.0070.07016.44
5.4.10.0030.04716.26
5.4.00.0070.07315.81

preferences:
66.47 ms | 400 KiB | 5 Q