3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Weather Scraper // Fetch the page for the city $contents = file_get_contents('http://www.weather-forecast.com/locations/Bend/forecasts/latest'); // Extract the 3 day Weather // The following pattern will yeild forecast in $matches[1] as of September 10, 2015 in the U.S.A. // However the multiple <span> blocks may possibly change causing this logic to fail in the future. $pattern = '/3 Day Weather Forecast Summary:<\/b><span class="read-more-small"><span class="read-more-content"> <span class="phrase">(.*?)</s'; preg_match( $pattern, $contents, $matches); $forecast1 = $matches[1]; // Instead, let's take a hopefully more robust approach and extract the forecast from $matches[0] using a less <span> intensive pattern // Note 1: We separately keep track of the search prefix, so we can remove this from the beginning of $matches[0]. // Note 2: We end the search on pattern not with '<', but with '<\/span' because we need to make sure we search to the first closing </span> $patternPrefix = '3 Day Weather Forecast Summary:'; $pattern = '/' . $patternPrefix . '(.*?)<\/span/s'; preg_match( $pattern, $contents, $matches); // $matches[0] starts with the $patternPrefix, so remove that from the beginning. $forecast2 = trim( substr($matches[0], strlen($patternPrefix)) ); echo $forecast1; echo $forecast2;

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.00618.80
8.3.50.0140.00721.31
8.3.40.0100.00719.35
8.3.30.0070.00719.35
8.3.20.0030.00620.72
8.3.10.0080.00023.77
8.3.00.0050.00322.83
8.2.180.0100.00617.00
8.2.170.0090.00622.96
8.2.160.0150.00320.60
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0060.00318.00
8.2.110.0130.01019.64
8.2.100.0040.00818.22
8.2.90.0080.00019.47
8.2.80.0040.00418.00
8.2.70.0030.00518.13
8.2.60.0050.00318.18
8.2.50.0000.00918.07
8.2.40.0050.00321.48
8.2.30.0040.00418.31
8.2.20.0040.00418.16
8.2.10.0060.00318.23
8.2.00.0050.00218.31
8.1.280.0100.00725.92
8.1.270.0000.00820.50
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0070.00722.25
8.1.230.0040.00820.98
8.1.220.0050.00317.90
8.1.210.0060.00319.03
8.1.200.0070.00317.63
8.1.190.0000.01017.60
8.1.180.0000.00818.10
8.1.170.0040.00418.96
8.1.160.0040.00423.98
8.1.150.0070.00019.03
8.1.140.0080.00017.80
8.1.130.0040.00717.85
8.1.120.0000.00717.84
8.1.110.0040.00417.75
8.1.100.0080.00017.75
8.1.90.0050.00317.79
8.1.80.0000.00717.78
8.1.70.0000.00717.74
8.1.60.0050.00517.83
8.1.50.0000.00917.81
8.1.40.0050.00317.76
8.1.30.0050.00317.91
8.1.20.0030.00617.91
8.1.10.0000.00817.92
8.1.00.0040.00417.86
8.0.300.0080.00020.23
8.0.290.0040.00417.25
8.0.280.0040.00418.69
8.0.270.0070.00017.61
8.0.260.0030.00317.50
8.0.250.0040.00417.38
8.0.240.0020.00517.34
8.0.230.0030.00417.34
8.0.220.0030.00317.34
8.0.210.0030.00517.29
8.0.200.0000.00817.34
8.0.190.0060.00317.25
8.0.180.0040.00417.32
8.0.170.0080.00017.34
8.0.160.0040.00417.34
8.0.150.0090.00017.20
8.0.140.0040.00417.39
8.0.130.0000.00613.75
8.0.120.0040.00417.36
8.0.110.0000.00817.37
8.0.100.0030.00517.27
8.0.90.0030.00517.40
8.0.80.0030.01517.37
8.0.70.0030.00517.32
8.0.60.0040.00417.35
8.0.50.0030.00517.35
8.0.30.0120.00717.42
8.0.20.0100.01017.61
8.0.10.0050.00317.29
8.0.00.0130.00917.08
7.4.330.0030.00315.08
7.4.320.0000.00616.95
7.4.300.0040.00416.70
7.4.290.0070.00016.82
7.4.280.0040.00516.87
7.4.270.0030.00316.91
7.4.260.0040.00416.88
7.4.250.0080.00016.90
7.4.240.0080.00016.98
7.4.230.0030.00316.77
7.4.220.0060.01217.02
7.4.210.0040.01217.03
7.4.200.0050.00317.00
7.4.160.0060.01217.11
7.4.150.0120.00617.40
7.4.140.0100.01017.86
7.4.130.0030.01417.05
7.4.120.0050.01416.96
7.4.110.0060.01216.96
7.4.100.0100.01417.02
7.4.90.0120.00616.96
7.4.80.0100.01019.39
7.4.70.0070.01116.89
7.4.60.0100.00716.97
7.4.50.0000.00616.76
7.4.40.0100.00816.86
7.4.30.0130.00717.04
7.4.00.0000.01415.25
7.3.330.0000.00513.80
7.3.320.0060.00013.83
7.3.310.0000.00816.97
7.3.300.0040.00416.78
7.3.290.0090.01016.89
7.3.280.0160.00716.87
7.3.270.0150.00417.40
7.3.260.0030.00716.79
7.3.250.0110.01016.95
7.3.240.0160.00416.77
7.3.230.0080.01716.71
7.3.210.0120.00616.78
7.3.200.0100.01319.39
7.3.190.0090.00916.86
7.3.180.0110.01116.71
7.3.170.0040.01416.88
7.3.160.0170.00716.86
7.3.00.0100.00317.06
7.2.330.0090.01316.98
7.2.320.0160.00817.02
7.2.310.0090.00917.09
7.2.300.0090.01217.07
7.2.290.0130.00617.21
7.2.130.0070.00317.54
7.2.120.0110.00617.33
7.2.110.0030.00917.54
7.2.100.0000.01017.45
7.2.90.0070.01117.33
7.2.80.0110.00317.26
7.2.70.0100.00717.25
7.2.60.0090.00717.37
7.2.50.0060.01217.29
7.2.40.0070.00717.23
7.2.30.0030.01117.23
7.2.20.0030.00817.11
7.2.10.0000.01117.27
7.2.00.0040.00718.46
7.1.250.0050.00516.43
7.1.240.0000.01115.95
7.1.230.0080.00816.27
7.1.220.0030.00715.98
7.1.210.0100.00316.35
7.1.200.0070.00815.99
7.1.190.0100.00716.40
7.1.180.0090.00915.91
7.1.170.0120.00616.30
7.1.160.0110.00716.33
7.1.150.0040.01116.36
7.1.140.0100.00316.48
7.1.130.0130.00316.33
7.1.120.0100.00716.06
7.1.110.0130.00716.23
7.1.100.0040.00817.37
7.1.90.0000.00916.36
7.1.80.0100.00716.23
7.1.70.0080.00516.71
7.1.60.0120.00617.96
7.1.50.0020.01316.89
7.1.40.0100.00715.86
7.1.30.0090.00616.29
7.1.20.0100.01015.95
7.1.10.0000.01415.86
7.1.00.0050.04419.20
7.0.330.0030.00715.80
7.0.320.0030.01315.84
7.0.310.0070.00715.87
7.0.300.0090.00315.84
7.0.290.0090.00415.87
7.0.280.0170.00315.60
7.0.270.0050.01015.87
7.0.260.0030.00715.73
7.0.250.0120.00015.93
7.0.240.0070.00615.71
7.0.230.0130.00315.87
7.0.220.0140.00015.93
7.0.210.0070.01015.77
7.0.200.0160.00415.72
7.0.190.0100.00315.84
7.0.180.0030.00615.67
7.0.170.0060.00915.77
7.0.160.0070.00815.89
7.0.150.0060.00815.39
7.0.140.0060.00615.72
7.0.130.0040.01115.73
7.0.120.0130.00315.64
7.0.110.0060.00615.86
7.0.100.0040.01215.92
7.0.90.0030.00715.75
7.0.80.0080.00815.72
7.0.70.0030.00915.60
7.0.60.0080.02318.02
7.0.50.0080.04217.06
7.0.40.0080.04517.25
7.0.30.0280.03817.10
7.0.20.0200.03717.10
7.0.10.0130.03717.05
7.0.00.0030.05117.20
5.6.380.0100.00614.58
5.6.370.0070.00714.38
5.6.360.0090.00614.30
5.6.350.0100.00314.28
5.6.340.0000.01114.68
5.6.330.0100.00514.46
5.6.320.0090.00314.65
5.6.310.0070.00714.70
5.6.300.0000.01314.71
5.6.290.0090.00614.56
5.6.280.0030.02118.02
5.6.270.0060.00614.34
5.6.260.0110.00414.77
5.6.250.0100.00314.53
5.6.240.0000.01314.77
5.6.230.0110.00414.73
5.6.220.0060.00614.69
5.6.210.0130.03617.76
5.6.200.0100.02716.56
5.6.190.0110.02017.70
5.6.180.0130.05017.72
5.6.170.0170.03217.74
5.6.160.0060.02317.79
5.6.150.0110.04216.57
5.6.140.0030.04716.64
5.6.130.0050.02916.55
5.6.120.0080.02317.92
5.6.110.0060.04518.08
5.6.100.0100.03518.07
5.6.90.0080.02617.96
5.6.80.0050.03417.67
5.6.70.1720.02017.65
5.6.60.0120.00614.49
5.6.50.0000.01314.59
5.6.40.0080.00014.85
5.6.30.0030.00914.46
5.6.20.0060.00314.61
5.6.10.0030.00914.60
5.6.00.0080.00014.45
5.5.380.0080.00311.49
5.5.370.0040.00811.48
5.5.360.0070.00411.18
5.5.350.0160.03916.17
5.5.340.0050.04214.84
5.5.330.0020.04216.20
5.5.320.0170.04215.89
5.5.310.0200.04316.14
5.5.300.0050.02514.73
5.5.290.0080.02214.94
5.5.280.0000.04816.28
5.5.270.0100.04116.22
5.5.260.0100.01816.39
5.5.250.0130.03416.20
5.5.240.0180.03615.93
5.5.230.0000.01011.42
5.5.220.0000.00811.22
5.5.210.0040.00411.42
5.5.200.0000.01011.57
5.5.190.0070.00311.46
5.5.180.0030.01011.33
5.5.170.0070.00411.17
5.5.160.0030.00311.13
5.5.150.0000.00611.42
5.5.140.0060.00611.61
5.5.130.0090.00311.45
5.5.120.0060.00611.07
5.5.110.0060.00311.21
5.5.100.0060.00611.38
5.5.90.0060.00011.44
5.5.80.0070.00311.41
5.5.70.0070.00011.39
5.5.60.0030.00611.46
5.5.50.0030.00611.24
5.5.40.0040.00411.61
5.5.30.0040.00411.48
5.5.20.0040.00711.47
5.5.10.0000.00811.36
5.5.00.0000.00711.11
5.4.450.0080.03615.58
5.4.440.0140.03015.75
5.4.430.0120.03015.58
5.4.420.0150.02515.57
5.4.410.0110.02815.44
5.4.400.0170.03715.49
5.4.390.0150.03215.31
5.4.380.0130.02615.30
5.4.370.0100.03115.49
5.4.360.0110.03015.34
5.4.350.0180.02315.56
5.4.340.0080.03315.42
5.4.330.0060.00011.16
5.4.320.0070.03615.29
5.4.310.0080.03215.37
5.4.300.0080.03515.49
5.4.290.0150.02515.46
5.4.280.0170.02815.21
5.4.270.0110.02615.32
5.4.260.0130.03015.31
5.4.250.0100.03015.46
5.4.240.0070.03715.36
5.4.230.0060.03315.38
5.4.220.0120.02915.22
5.4.210.0100.03015.38
5.4.200.0150.02314.30
5.4.190.0130.02815.47
5.4.180.0150.02715.29
5.4.170.0060.03315.31
5.4.160.0070.03515.24
5.4.150.0100.03215.27
5.4.140.0080.03014.22
5.4.130.0120.02313.90
5.4.120.0130.02514.07
5.4.110.0130.02614.06
5.4.100.0110.02813.99
5.4.90.0150.02413.99
5.4.80.0120.02514.06
5.4.70.0160.03314.20
5.4.60.0070.03714.26
5.4.50.0050.03914.02
5.4.40.0100.02114.17
5.4.30.0200.03314.21
5.4.20.0220.03014.11
5.4.10.0030.00911.45
5.4.00.0030.01011.27

preferences:
56.15 ms | 401 KiB | 5 Q