3v4l.org

run code in 300+ PHP versions simultaneously
<?php // API access key from Google API's Console define( 'API_ACCESS_KEY', 'AIzaSyBNVpyGHobo0YbdyOejbL7ixMES9iwV6VA' ); $registrationIds = array("APA91bHgZ3qu3-VeJ0RC0J9EyB33qX5jB4pX1qEiZtdEiYSJoF8gYA67AeL0j4g7z6sNwLHg1kIQ__p5foZhWnXBybhcEZjp650DzUZXqQBf_fZnWc8xqVIMQMUrdHOtzYDX7DsyL7fyFFoUsF9pElZh8AYftELjlGbJqs-mGZSYg6zBVgXjhq0"); // prep the bundle $msg = array ( 'message' => 'Hello Prem here. Did you get this. message', 'title' => 'This is a title. title', 'subtitle' => 'This is a subtitle. subtitle', 'tickerText' => 'Ticker text here...Ticker text here...Ticker text here', 'vibrate' => 1, 'sound' => 1 ); $fields = array ( 'registration_ids' => $registrationIds, 'data' => $msg ); $headers = array ( 'Authorization: key=' . API_ACCESS_KEY//, //'Content-Type: application/json' ); // Submit those variables to the server $post_data = array( 'test' => 'foobar', 'okay' => 'yes', 'number' => 2 ); // Send a request to example.com $result = post_request('https://android.googleapis.com/gcm/send', $fields, $headers); //$ch = curl_init(); //curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' ); //curl_setopt( $ch,CURLOPT_POST, true ); //curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); //curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); //curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false ); //curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) ); //$result = curl_exec($ch ); //curl_close( $ch ); echo $result; function post_request($url, $data, $headers, $referer='') { // Convert the data array into URL Parameters like a=b&foo=bar etc. $data = http_build_query($data); // parse the given URL $url = parse_url($url); if ($url['scheme'] != 'http') { die('Error: Only HTTP request are supported !'); } // extract host and path: $host = $url['host']; $path = $url['path']; // open a socket connection on port 80 - timeout: 30 sec $fp = fsockopen($host, 80, $errno, $errstr, 30); if ($fp){ // send the request headers: fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); if ($referer != '') fputs($fp, "Referer: $referer\r\n"); fputs($fp, $headers); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while(!feof($fp)) { // receive the results of the request $result .= fgets($fp, 128); } } else { return array( 'status' => 'err', 'error' => "$errstr ($errno)" ); } // close the socket connection: fclose($fp); // split the result header from the content $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; // return as structured array: return array( 'status' => 'ok', 'header' => $header, 'content' => $content ); } ?>

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.00716.63
8.3.50.0140.00722.01
8.3.40.0160.00018.65
8.3.30.0090.00619.04
8.3.20.0080.00020.29
8.3.10.0000.00821.77
8.3.00.0040.00419.26
8.2.180.0110.00718.29
8.2.170.0000.01519.14
8.2.160.0130.00722.96
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0000.00722.11
8.2.110.0070.00322.16
8.2.100.0000.01218.03
8.2.90.0050.00319.29
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0040.00417.55
8.2.50.0000.00818.07
8.2.40.0060.00320.07
8.2.30.0000.00718.05
8.2.20.0000.00917.88
8.2.10.0000.00818.22
8.2.00.0000.01117.89
8.1.280.0120.00325.92
8.1.270.0070.00423.99
8.1.260.0050.00526.35
8.1.250.0080.00028.09
8.1.240.0030.00623.83
8.1.230.0030.00718.97
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0050.00517.36
8.1.190.0000.00917.53
8.1.180.0060.00318.10
8.1.170.0090.00018.58
8.1.160.0000.00722.04
8.1.150.0060.00318.66
8.1.140.0040.00417.47
8.1.130.0000.00717.91
8.1.120.0040.00417.50
8.1.110.0000.00817.43
8.1.100.0040.00417.50
8.1.90.0030.00517.52
8.1.80.0050.00317.46
8.1.70.0030.00317.38
8.1.60.0030.00617.62
8.1.50.0000.00817.47
8.1.40.0000.00817.40
8.1.30.0060.00317.55
8.1.20.0050.00317.55
8.1.10.0040.00417.44
8.1.00.0030.00617.55
8.0.300.0040.00420.73
8.0.290.0050.00317.05
8.0.280.0000.00718.38
8.0.270.0030.00317.40
8.0.260.0030.00317.28
8.0.250.0000.00717.07
8.0.240.0070.00017.04
8.0.230.0000.00716.95
8.0.220.0070.00016.96
8.0.210.0000.00717.04
8.0.200.0000.00717.07
8.0.190.0000.00817.09
8.0.180.0030.00716.94
8.0.170.0040.00416.87
8.0.160.0040.00417.01
8.0.150.0030.00516.96
8.0.140.0030.00317.00
8.0.130.0030.00313.48
8.0.120.0050.00316.97
8.0.110.0040.00416.96
8.0.100.0050.00316.95
8.0.90.0040.00416.94
8.0.80.0120.00417.02
8.0.70.0020.00516.80
8.0.60.0000.00716.95
8.0.50.0040.00416.77
8.0.30.0080.01117.17
8.0.20.0070.01117.40
8.0.10.0070.00017.04
8.0.00.0150.00316.90
7.4.330.0030.00315.15
7.4.320.0070.00016.53
7.4.300.0070.00016.54
7.4.290.0030.00316.53
7.4.280.0040.00416.52
7.4.270.0000.00716.56
7.4.260.0060.00316.63
7.4.250.0000.00716.57
7.4.240.0020.00516.56
7.4.230.0030.00316.36
7.4.220.0100.00716.60
7.4.210.0080.00916.65
7.4.200.0000.00716.43
7.4.190.0000.00716.71
7.4.160.0100.00616.70
7.4.150.0040.01417.40
7.4.140.0120.00417.86
7.4.130.0080.00816.54
7.4.120.0110.00716.51
7.4.110.0150.00416.47
7.4.100.0130.00616.66
7.4.90.0120.00616.52
7.4.80.0120.00619.39
7.4.70.0140.00316.57
7.4.60.0060.01016.54
7.4.50.0060.00016.62
7.4.40.0100.00722.77
7.4.30.0090.00916.75
7.4.00.0070.01114.83
7.3.330.0050.00013.23
7.3.320.0000.00713.41
7.3.310.0080.00016.40
7.3.300.0030.00316.27
7.3.290.0110.00416.39
7.3.280.0090.01016.34
7.3.270.0110.00717.40
7.3.260.0130.00416.38
7.3.250.0080.01016.62
7.3.240.0100.00716.58
7.3.230.0170.00016.40
7.3.210.0060.01216.55
7.3.200.0130.01319.39
7.3.190.0140.00416.50
7.3.180.0090.00616.59
7.3.170.0030.01316.52
7.3.160.0140.00616.39
7.3.120.0120.00314.77
7.3.10.0040.01116.72
7.3.00.0130.00016.56
7.2.330.0110.00816.83
7.2.320.0170.00016.83
7.2.310.0060.01116.51
7.2.300.0060.01016.83
7.2.290.0070.01016.56
7.2.130.0060.00916.90
7.2.120.0030.00816.96
7.2.110.0080.00416.92
7.2.100.0090.00016.70
7.2.90.0000.01516.89
7.2.80.0060.00616.98
7.2.70.0080.00316.93
7.2.60.0100.00016.80
7.2.50.0070.00416.89
7.2.40.0080.00416.88
7.2.30.0080.00316.77
7.2.20.0090.00316.71
7.2.10.0100.00017.13
7.2.00.0090.00418.04
7.1.250.0060.00615.68
7.1.200.0040.00815.73
7.1.100.0090.00318.02
7.1.70.0050.00217.23
7.1.60.0150.01119.46
7.1.50.0090.01616.96
7.1.00.0100.06722.45
7.0.200.0000.00916.73
7.0.140.0000.07322.09
7.0.60.0170.07720.05
7.0.50.0070.04317.89
7.0.40.0070.04020.24
7.0.30.0570.07320.25
7.0.20.0230.08320.16
7.0.10.0130.09020.10
7.0.00.0130.07720.22
5.6.210.0170.07320.63
5.6.200.0070.08718.23
5.6.190.0000.08720.57
5.6.180.0230.08020.58
5.6.170.0200.05720.57
5.6.160.0030.05320.54
5.6.150.0000.07318.17
5.6.140.0070.04018.27
5.6.130.0000.04318.17
5.6.120.0070.06021.14
5.6.110.0030.04321.13
5.6.100.0100.07321.15
5.6.90.0100.07720.98
5.6.80.0200.05720.43
5.6.70.0100.08020.38
5.5.350.0170.08020.35
5.5.340.0070.05317.94
5.5.330.0070.08320.21
5.5.320.0470.06720.31
5.5.310.0130.04320.27
5.5.300.0070.05717.98
5.5.290.0030.07018.08
5.5.280.0100.03720.89
5.5.270.0000.09320.88
5.5.260.0200.07020.84
5.5.250.0070.04720.81
5.5.240.0230.04020.17
5.4.450.0770.06719.47
5.4.440.0730.06019.34
5.4.430.0400.06319.47
5.4.420.0630.05319.48
5.4.410.0870.07019.45
5.4.400.0500.05018.84
5.4.390.0600.06319.15
5.4.380.0430.04718.61
5.4.370.0600.06018.48
5.4.360.0300.05018.77
5.4.350.0170.06318.78
5.4.340.0430.04718.60
5.4.320.0060.03912.52
5.4.310.0070.04712.52
5.4.300.0090.03812.52
5.4.290.0100.03612.50
5.4.280.0050.03912.40
5.4.270.0060.03712.39
5.4.260.0070.03912.40
5.4.250.0100.05212.40
5.4.240.0090.03812.39
5.4.230.0110.03812.39
5.4.220.0040.04112.39
5.4.210.0080.03312.39
5.4.200.0070.03512.39
5.4.190.0040.03712.38
5.4.180.0060.03512.39
5.4.170.0070.03412.40
5.4.160.0090.03212.38
5.4.150.0050.04012.39
5.4.140.0110.04012.07
5.4.130.0070.04512.06
5.4.120.0060.03512.02
5.4.110.0090.03512.01
5.4.100.0130.04412.01
5.4.90.0060.05012.01
5.4.80.0050.04212.02
5.4.70.0100.03612.01
5.4.60.0100.03312.01
5.4.50.0070.03812.00
5.4.40.0060.03412.00
5.4.30.0040.04912.00
5.4.20.0080.05012.00
5.4.10.0080.04911.99
5.4.00.0110.03411.48
5.3.290.0080.04712.80
5.3.280.0100.03912.71
5.3.270.0050.04112.72
5.3.260.0060.04212.72
5.3.250.0080.03612.72
5.3.240.0100.03312.72
5.3.230.0030.04512.71
5.3.220.0090.03412.68
5.3.210.0060.04112.68
5.3.200.0080.04112.68
5.3.190.0080.03812.68
5.3.180.0100.03312.67
5.3.170.0030.04012.67
5.3.160.0070.05512.67
5.3.150.0120.05112.67
5.3.140.0080.05212.66
5.3.130.0070.04312.66
5.3.120.0060.04012.66
5.3.110.0090.04212.66
5.3.100.0060.03712.14
5.3.90.0060.03812.13
5.3.80.0100.03412.12
5.3.70.0070.03712.11
5.3.60.0080.03512.11
5.3.50.0030.03912.05
5.3.40.0070.03612.04
5.3.30.0060.03812.01
5.3.20.0110.03411.79
5.3.10.0090.03611.75
5.3.00.0070.04111.74
5.2.170.0050.0419.24
5.2.160.0070.0369.24
5.2.150.0080.0339.25
5.2.140.0040.0339.24
5.2.130.0070.0379.20
5.2.120.0070.0419.20
5.2.110.0030.0399.21
5.2.100.0040.0409.20
5.2.90.0040.0309.21
5.2.80.0100.0259.20
5.2.70.0010.0349.20
5.2.60.0030.0329.16
5.2.50.0020.0339.12
5.2.40.0060.0289.10
5.2.30.0040.0309.08
5.2.20.0030.0309.07
5.2.10.0060.0288.97
5.2.00.0050.0298.83
5.1.60.0050.0248.11
5.1.50.0080.0248.11
5.1.40.0050.0308.09
5.1.30.0110.0298.44
5.1.20.0060.0318.47
5.1.10.0090.0258.19
5.1.00.0040.0278.20
5.0.50.0030.0236.68
5.0.40.0040.0256.54
5.0.30.0050.0416.35
5.0.20.0030.0286.31
5.0.10.0070.0246.29
5.0.00.0020.0416.29
4.4.90.0050.0224.77
4.4.80.0030.0214.76
4.4.70.0050.0184.75
4.4.60.0040.0204.76
4.4.50.0050.0224.77
4.4.40.0020.0284.71
4.4.30.0020.0194.76
4.4.20.0080.0164.84
4.4.10.0030.0174.85
4.4.00.0020.0284.76
4.3.110.0040.0224.66
4.3.100.0030.0184.67
4.3.90.0060.0194.63
4.3.80.0030.0334.59
4.3.70.0030.0214.63
4.3.60.0050.0224.63
4.3.50.0030.0194.63
4.3.40.0060.0314.54
4.3.30.0020.0223.33
4.3.20.0050.0193.32
4.3.10.0020.0193.27
4.3.00.0030.03010.54

preferences:
40.82 ms | 400 KiB | 5 Q