3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<h1>Hello, PHP!</h1>"; $file = fopen("input.txt","r"); $list = new SplDoublyLinkedList(); //$list = new LinkList(); while(! feof($file)) { //print_r(fgetcsv($file)); $list->push(fgets($file)); //print_r(fgets($file)); } fclose($file); $list->rewind(); $currCityP = str_getcsv($list->current()); $string=implode(",",$currCityP); //echo "Init CurrCityP".$string."\r\n<br>"; $nextCityP = str_getcsv($list->current()); $string=implode(",",$nextCityP); //echo "Init nextCityP".$string."\r\n<br>"; //echo "Total num of cities is: ".$list->count()."\r\n<br>"; for ($x=1; $x<=$list->count(); $x++) { $currCityP = $nextCityP; $y=1; $min=10000; for ($list->rewind(); $list->valid(); $list->next()) { $tmpCityP = str_getcsv($list->current()); if ($y == $x+1) { $nextCityP = $tmpCityP; //echo "x & y are: ".$x.", ".$y."\r\n<br>"; } $y++; $dist = sqrt(pow(($tmpCityP[0]-$currCityP[0]),2)+pow(($tmpCityP[1]-$currCityP[1]),2)); if ($min > $dist && $dist != 0) { $min = $dist; } //echo "Distane".$dist."\r\n"; //echo "next\r\n"; } $string=implode(",",$currCityP); //echo "CurrCityP is: ".$string."\r\n<br>"; $string=implode(",",$nextCityP); //echo "NextCityP is: ".$string."\r\n<br>"; echo $min."\r\n<br>"; }

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.0130.00318.43
8.3.50.0130.00922.04
8.3.40.0080.00819.00
8.3.30.0040.01119.20
8.3.20.0000.00820.34
8.3.10.0030.00523.64
8.3.00.0040.00422.46
8.2.180.0070.00718.69
8.2.170.0140.00722.96
8.2.160.0060.00922.07
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0050.00222.09
8.2.110.0030.00622.16
8.2.100.0060.00617.84
8.2.90.0000.00919.23
8.2.80.0000.00818.02
8.2.70.0000.00917.63
8.2.60.0040.00418.04
8.2.50.0030.00518.07
8.2.40.0050.00318.16
8.2.30.0040.00418.09
8.2.20.0000.00717.76
8.2.10.0060.00319.57
8.2.00.0000.00717.69
8.1.280.0090.00625.92
8.1.270.0040.00423.91
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0000.00923.84
8.1.230.0030.00719.06
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0090.00017.23
8.1.190.0030.00617.41
8.1.180.0040.00418.10
8.1.170.0040.00418.56
8.1.160.0040.00421.92
8.1.150.0000.00818.50
8.1.140.0040.00417.35
8.1.130.0000.00717.91
8.1.120.0070.00017.46
8.1.110.0000.00717.48
8.1.100.0000.00717.46
8.1.90.0080.00317.31
8.1.80.0020.00517.43
8.1.70.0070.00017.39
8.1.60.0000.00917.46
8.1.50.0050.00417.45
8.1.40.0000.00817.48
8.1.30.0040.00417.69
8.1.20.0000.00817.53
8.1.10.0040.00417.65
8.1.00.0000.00717.59
8.0.300.0080.00018.77
8.0.290.0000.00717.30
8.0.280.0000.00718.61
8.0.270.0000.00717.38
8.0.260.0000.00616.95
8.0.250.0000.00717.06
8.0.240.0050.00317.00
8.0.230.0040.00416.95
8.0.220.0030.00316.98
8.0.210.0040.00416.87
8.0.200.0000.00716.96
8.0.190.0090.00016.96
8.0.180.0040.00417.05
8.0.170.0000.00817.06
8.0.160.0040.00417.03
8.0.150.0040.00416.84
8.0.140.0050.00316.86
8.0.130.0000.00613.46
8.0.120.0050.00316.86
8.0.110.0040.00417.00
8.0.100.0000.00717.01
8.0.90.0040.00416.91
8.0.80.0050.01116.96
8.0.70.0030.00616.93
8.0.60.0000.00716.88
8.0.50.0000.00716.93
8.0.30.0100.00817.17
8.0.20.0100.01217.40
8.0.10.0070.00017.18
8.0.00.0090.01116.67
7.4.330.0070.00015.03
7.4.320.0000.00916.46
7.4.300.0000.00716.54
7.4.290.0030.00716.51
7.4.280.0050.00616.35
7.4.270.0040.00816.52
7.4.260.0040.00416.54
7.4.250.0000.01016.43
7.4.240.0030.00516.40
7.4.230.0050.00516.55
7.4.220.0090.00916.46
7.4.210.0080.01016.46
7.4.200.0100.00016.42
7.4.190.0040.00416.61
7.4.160.0280.01416.42
7.4.150.0430.02317.40
7.4.140.0430.01517.86
7.4.130.0400.00816.55
7.4.120.0200.01116.52
7.4.110.0500.00916.51
7.4.100.0090.01316.45
7.4.90.0130.00916.42
7.4.80.0430.01419.37
7.4.70.0290.01216.69
7.4.60.0120.00616.51
7.4.50.0050.00516.54
7.4.40.0040.01622.77
7.4.30.0030.01816.46
7.4.00.0090.00914.85
7.3.330.0070.00013.04
7.3.320.0000.00613.05
7.3.310.0070.00716.23
7.3.300.0030.00616.03
7.3.290.0040.01616.23
7.3.280.0090.01216.21
7.3.270.0200.00417.40
7.3.260.0490.00816.29
7.3.250.0170.00816.19
7.3.240.0210.00816.36
7.3.230.0370.01516.39
7.3.210.0070.01416.36
7.3.200.0310.01519.39
7.3.190.1330.01716.45
7.3.180.0320.01616.07
7.3.170.0080.01216.27
7.3.160.0080.01216.34
7.3.120.0060.01014.99
7.3.10.0180.00316.29
7.3.00.0300.00416.31
7.2.330.0630.02416.71
7.2.320.0140.00716.61
7.2.310.0220.01416.57
7.2.300.0170.02816.38
7.2.290.0160.02216.66
7.2.130.0150.01516.48
7.2.120.0550.00314.78
7.2.110.0620.00614.84
7.2.100.0160.01314.71
7.2.90.1640.00616.71
7.2.80.2070.02217.10
7.2.70.0250.01416.75
7.2.60.0200.01016.90
7.2.50.0300.00416.74
7.2.40.0260.00916.85
7.2.30.0210.01216.78
7.2.20.0220.00916.73
7.2.10.0230.00816.56
7.2.00.0040.01516.68
7.1.250.0210.01215.57
7.1.100.0080.00417.89
7.1.70.0060.00316.93
7.1.60.0060.01919.29
7.1.50.0060.01917.02
7.0.200.0000.01316.55

preferences:
44.77 ms | 400 KiB | 5 Q