3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Satmap; class Http { /* A place to store our $_SERVER var for work */ public static $server; /* Comparison constants for methods */ const GET = 'get'; const POST = 'post'; const PUT = 'put'; const DELETE = 'delete'; const PATCH = 'patch'; /* An array of all valid status codes */ public static $status_codes = [ 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 204 => 'No Content', 301 => 'Moved Permanently', 302 => 'Found', 304 => 'Not Modified', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 409 => 'Conflict', 418 => 'I\'m A Teapot', 420 => 'Rate Limited', 429 => 'Rate Limited', 500 => 'Server Error', 502 => 'Bad Gateway', 503 => 'Unavailable', 504 => 'Gateway Timeout' ]; /* An array of all valid http methods */ public static $methods = ['post','get','put','patch','delete']; /* An array of json mine types */ public static $json_mimes = ['application/json','text/json','text/javascript']; /* An array for url form */ public static $form_mimes = ['application/x-www-form-urlencoded']; /* Pass our SERVER to the class to work with */ public function __construct(){ self::$server = $_SERVER; } public static function collect(){ self::$server = $_SERVER; } /* Get and validate our method */ public static function method(){ return isset(self::$server['REQUEST_METHOD']) ? (in_array(strtolower(self::$server['REQUEST_METHOD']), self::$methods) ? strtolower(self::$server['REQUEST_METHOD']) : false) : false; } /* Check if request is secured */ public static function secure(){ if(self::$server['SERVER_PORT'] == 443 && self::$server['HTTPS'] !== ''){ return true; } else { return false; } } /* Get an array of query string */ public static function query(){ $query = self::$server['QUERY_STRING']; if(strlen($query) > 0){ parse_str($query,$array); return $array; } else { return false; } } /* Get an array of our path $offset will trip the array by that many keys this useful for treating subfolder as root */ public static function path($offset = null){ // Get our uri from the server $uri = self::$server['REQUEST_URI']; // Remove our query. if(self::query()){ $uri = str_replace("?".self::$server['QUERY_STRING'],"",$uri); } // Remove a trailing slash $length = strlen($uri); if($uri[$length-1] == "/"){ $uri = substr($uri,0,-1); } // Remove a preceding slash if($uri[0] == "/"){ $uri = substr($uri,1,$length); } // Split our string $uri = explode("/",$uri); // Process our offset if($offset){ for($i = 0; $i < $offset; $i++){ unset($uri[$i]); } } // Return our array return $uri; } /* Get post raw body */ public static function full_body(){ $body = file_get_contents('php://input'); return strlen($body) > 0 ? $body : false; } /* Gets a processed body */ public static function body(){ $body = self::full_body(); if($body && self::is_json()){ return json_decode($body); } else if($body && self::is_form()){ parse_str($body,$array); return $array; } else { return $body; } } /* Get our mime type */ public static function mime(){ $mime = (isset(self::$server['CONTENT_TYPE']) ? self::$server['CONTENT_TYPE'] : ""); return strlen($mime) ? $mime : false; } /* Checks if our body is JSON */ public static function is_json(){ return self::mime() && in_array(self::mime(),self::$json_mimes) ? true : false; } /* Checks if our body is FROM */ public static function is_form(){ return self::mime() && in_array(self::mime(),self::$form_mimes) ? true : false; } /* Set a header code for response */ public static function set_code($code){ return http_response_code($code); } /* Set a header code for response */ public static function set_mime($type){ return header('Content-Type: '.$type); } } Satmap\Http::collect();

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.01018.56
8.3.50.0120.00822.07
8.3.40.0150.00018.82
8.3.30.0150.00019.22
8.3.20.0050.00320.35
8.3.10.0030.00620.50
8.3.00.0040.00419.38
8.2.180.0100.00617.00
8.2.170.0070.01122.96
8.2.160.0130.00020.46
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00422.06
8.2.110.0030.00721.00
8.2.100.0110.00017.78
8.2.90.0000.00819.23
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0050.00317.93
8.2.50.0030.00618.10
8.2.40.0020.00518.20
8.2.30.0000.00719.26
8.2.20.0050.00217.68
8.2.10.0040.00417.93
8.2.00.0040.00417.77
8.1.280.0090.00625.92
8.1.270.0000.00722.19
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.92
8.1.230.0040.00717.71
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0000.00817.23
8.1.180.0050.00318.10
8.1.170.0000.00818.51
8.1.160.0030.00521.94
8.1.150.0040.00418.74
8.1.140.0030.00617.38
8.1.130.0040.00417.70
8.1.120.0040.00417.21
8.1.110.0050.00217.35
8.1.100.0040.00417.25
8.1.90.0040.00417.38
8.1.80.0030.00317.27
8.1.70.0050.00217.25
8.1.60.0030.00617.49
8.1.50.0040.00717.36
8.1.40.0040.00417.54
8.1.30.0030.00517.59
8.1.20.0030.00517.64
8.1.10.0050.00317.42
8.1.00.0000.00817.56
8.0.300.0060.00318.77
8.0.290.0040.00416.75
8.0.280.0000.00718.40
8.0.270.0000.00717.10
8.0.260.0000.00617.14
8.0.250.0000.00716.89
8.0.240.0000.00716.89
8.0.230.0050.00316.87
8.0.220.0040.00416.94
8.0.210.0070.00016.92
8.0.200.0040.00417.00
8.0.190.0000.00816.96
8.0.180.0050.00316.83
8.0.170.0050.00216.93
8.0.160.0030.00516.75
8.0.150.0050.00316.92
8.0.140.0040.00416.84
8.0.130.0060.00013.38
8.0.120.0040.00416.91
8.0.110.0040.00416.90
8.0.100.0040.00416.95
8.0.90.0000.00816.76
8.0.80.0030.01716.83
8.0.70.0000.00716.88
8.0.60.0080.00016.92
8.0.50.0040.00416.79
8.0.30.0090.01117.12
8.0.20.0080.01117.40
8.0.10.0050.00217.05
8.0.00.0140.00516.70
7.4.330.0050.00015.00
7.4.320.0040.00416.42
7.4.300.0000.00616.39
7.4.290.0040.00416.61
7.4.280.0040.00816.52
7.4.270.0030.00316.48
7.4.260.0000.00716.35
7.4.250.0050.00216.34
7.4.240.0000.00716.51
7.4.230.0070.00016.27
7.4.220.0120.00616.43
7.4.210.0040.01616.53
7.4.200.0030.00316.31
7.4.160.0040.01216.47
7.4.150.0090.01217.40
7.4.140.0110.00617.86
7.4.130.0130.00616.50
7.4.120.0140.00416.61
7.4.110.0120.00416.47
7.4.100.0120.00416.52
7.4.90.0110.00816.39
7.4.80.0080.01119.03
7.4.70.0090.01216.38
7.4.60.0000.02016.61
7.4.50.0030.00516.39
7.4.40.0140.00616.46
7.4.30.0060.01516.48
7.4.10.0060.00914.76
7.4.00.0040.01114.95
7.3.330.0000.00913.29
7.3.320.0030.00313.12
7.3.310.0040.00416.36
7.3.300.0040.00416.33
7.3.290.0000.01816.33
7.3.280.0100.00616.38
7.3.270.0040.01417.40
7.3.260.0070.01016.31
7.3.250.0140.00716.35
7.3.240.0130.00716.62
7.3.230.0110.00916.39
7.3.210.0060.01216.19
7.3.200.0100.01019.39
7.3.190.0070.01016.32
7.3.180.0100.00716.49
7.3.170.0090.01316.59
7.3.160.0110.00516.42
7.3.130.0080.00914.76
7.3.120.0080.01014.57
7.3.110.0100.00914.94
7.3.100.0100.00414.72
7.3.90.0070.00714.79
7.3.80.0100.00314.82
7.3.70.0050.00714.74
7.3.60.0030.01014.69
7.3.50.0020.01014.80
7.3.40.0030.01014.85
7.3.30.0080.00414.84
7.3.20.0020.01116.56
7.3.10.0090.00616.44
7.3.00.0070.00616.48
7.2.330.0140.00316.73
7.2.320.0090.00916.65
7.2.310.0090.00916.70
7.2.300.0060.00916.60
7.2.290.0070.01016.64
7.2.260.0080.01115.11
7.2.250.0100.00814.92
7.2.240.0020.01314.75
7.2.230.0060.01015.06
7.2.220.0090.00615.14
7.2.210.0050.00814.83
7.2.200.0060.00714.89
7.2.190.0070.00714.89
7.2.180.0030.00815.00
7.2.170.0070.00714.84
7.2.160.0030.00914.89
7.2.150.0000.01316.83
7.2.140.0020.00916.62
7.2.130.0060.00616.62
7.2.120.0070.00816.62
7.2.110.0060.00616.54
7.2.100.0080.00816.59
7.2.90.0040.01116.75
7.2.80.0040.01316.60
7.2.70.0030.01016.72
7.2.60.0080.00816.68
7.2.50.0040.00916.48
7.2.40.0080.00616.64
7.2.30.0070.01016.71
7.2.20.0040.01116.71
7.2.10.0090.00716.66
7.2.00.0060.01016.79
7.1.330.0010.01215.57
7.1.320.0060.00915.36
7.1.310.0060.00715.54
7.1.300.0070.00415.50
7.1.290.0030.00915.58
7.1.280.0050.00715.51
7.1.270.0020.00915.62
7.1.260.0080.00815.68
7.1.250.0060.00615.44
7.1.240.0090.00515.55
7.1.230.0050.00615.36
7.1.220.0080.00515.68
7.1.210.0060.00415.55
7.1.200.0070.00515.60
7.1.190.0050.01015.55
7.1.180.0060.00815.59
7.1.170.0050.00815.64
7.1.160.0070.00715.59
7.1.150.0110.00515.61
7.1.140.0020.00815.65
7.1.130.0040.00915.54
7.1.120.0060.00715.41
7.1.110.0030.01215.58
7.1.100.0080.00516.33
7.1.90.0050.01015.59
7.1.80.0050.00815.61
7.1.70.0040.00815.93
7.1.60.0080.01016.93
7.1.50.0080.00715.87
7.1.40.0080.00315.51
7.1.30.0040.00915.71
7.1.20.0050.00715.51
7.1.10.0020.01315.51
7.1.00.0020.03017.91
7.0.330.0030.00815.33
7.0.320.0030.00715.23
7.0.310.0030.00715.23
7.0.300.0090.00615.32
7.0.290.0050.00715.25
7.0.280.0080.00415.24
7.0.270.0060.00315.29
7.0.260.0030.00915.20
7.0.250.0100.00315.37
7.0.240.0020.01215.25
7.0.230.0070.00415.34
7.0.220.0060.00715.28
7.0.210.0070.00615.12
7.0.200.0060.00515.70
7.0.190.0070.00615.07
7.0.180.0070.00715.19
7.0.170.0090.00215.29
7.0.160.0050.00815.09
7.0.150.0080.00515.34
7.0.140.0040.03017.58
7.0.130.0030.00815.36
7.0.120.0040.00615.22
7.0.110.0050.00815.23
7.0.100.0090.00415.37
7.0.90.0050.00715.25
7.0.80.0030.00915.11
7.0.70.0060.01015.27
7.0.60.0030.03216.90
7.0.50.0050.01816.18
7.0.40.0030.02615.65
7.0.30.0140.01315.70
7.0.20.0030.02415.62
7.0.10.0020.02215.62
7.0.00.0060.02315.71
5.6.400.0070.00314.31
5.6.390.0050.00914.24
5.6.380.0060.00614.21
5.6.370.0070.00614.29
5.6.360.0090.00514.11
5.6.350.0040.00914.08
5.6.340.0080.00714.24
5.6.330.0030.00914.40
5.6.320.0100.00714.31
5.6.310.0100.00214.28
5.6.300.0030.01214.24
5.6.290.0020.01114.04
5.6.280.0030.03116.38
5.6.270.0050.00814.27
5.6.260.0060.00614.36
5.6.250.0090.00314.25
5.6.240.0070.00414.25
5.6.230.0140.00014.26
5.6.220.0050.01114.23
5.6.210.0080.02716.36
5.6.200.0040.03315.61
5.6.190.0080.03316.40
5.6.180.0110.03016.36
5.6.170.0140.02916.37
5.6.160.0080.03316.24
5.6.150.0050.02415.69
5.6.140.0060.01815.59
5.6.130.0050.03415.54
5.6.120.0080.02016.47
5.6.110.0050.01716.39
5.6.100.0050.03216.56
5.6.90.0070.01916.70
5.6.80.0060.02616.39
5.6.70.0070.00714.21
5.6.60.0070.00414.06
5.6.50.0050.00814.24
5.6.40.0030.00814.29
5.6.30.0060.00614.10
5.6.20.0000.01114.15
5.6.10.0060.00414.03
5.6.00.0050.00614.16
5.5.380.0050.00714.14
5.5.370.0050.00914.13
5.5.360.0050.00714.16
5.5.350.0060.03416.24
5.5.340.0050.02915.41
5.5.330.0080.02716.22
5.5.320.0030.02016.16
5.5.310.0110.03116.13
5.5.300.0020.02215.55
5.5.290.0080.02615.42
5.5.280.0060.02016.45
5.5.270.0070.03516.45
5.5.260.0100.02716.43
5.5.250.0070.02716.19
5.5.240.0160.02016.21
5.5.230.0050.00914.19
5.5.220.0090.00314.04
5.5.210.0060.00813.97
5.5.200.0050.00513.99
5.5.190.0050.00614.15
5.5.180.0060.00513.97
5.5.170.0100.00514.24
5.5.160.0080.00514.16
5.5.150.0060.00614.20
5.5.140.0060.00913.77
5.5.130.0070.00414.07
5.5.120.0050.00713.95
5.5.110.0040.00613.96
5.5.100.0090.00614.25
5.5.90.0110.00214.10
5.5.80.0080.00314.28
5.5.70.0070.00514.01
5.5.60.0030.01013.86
5.5.50.0050.00914.27
5.5.40.0080.00614.01
5.5.30.0030.00813.82
5.5.20.0060.00614.04
5.5.10.0060.00613.81
5.5.00.0050.01014.03
5.4.450.0300.02114.11
5.4.440.0100.02113.96
5.4.430.0080.02114.11
5.4.420.0260.00314.12
5.4.410.0240.00614.11
5.4.400.0280.00613.92
5.4.390.0220.00214.00
5.4.380.0120.03013.72
5.4.370.0180.01713.80
5.4.360.0090.02213.81
5.4.350.0140.02813.80
5.4.340.0170.02013.87
5.4.330.0060.00611.52
5.4.320.0050.01411.79
5.4.310.0050.01811.75
5.4.300.0050.01711.78
5.4.290.0070.01511.77
5.4.280.0040.01511.82
5.4.270.0050.01611.72
5.4.260.0030.01811.74
5.4.250.0030.01811.78
5.4.240.0050.01811.82
5.4.230.0040.01911.75
5.4.220.0040.01611.75
5.4.210.0030.01811.80
5.4.200.0050.01611.73
5.4.190.0050.01611.77
5.4.180.0070.01411.68
5.4.170.0030.01711.78
5.4.160.0030.01711.73
5.4.150.0020.01911.61
5.4.140.0050.01811.64
5.4.130.0050.02111.65
5.4.120.0050.02111.56
5.4.110.0070.01411.62
5.4.100.0030.01911.62
5.4.90.0060.01511.65
5.4.80.0050.01511.63
5.4.70.0040.01911.56
5.4.60.0060.01611.62
5.4.50.0060.02111.67
5.4.40.0070.01611.61
5.4.30.0040.01811.63
5.4.20.0050.01511.67
5.4.10.0060.01711.54
5.4.00.0070.02011.46
5.3.290.0030.05312.80
5.3.280.0060.03812.71
5.3.270.0110.04012.72
5.3.260.0040.04212.71
5.3.250.0090.05212.72
5.3.240.0090.03712.72
5.3.230.0060.03712.71
5.3.220.0030.04512.68
5.3.210.0070.03712.68
5.3.200.0080.03412.68
5.3.190.0060.03612.68
5.3.180.0050.03612.68
5.3.170.0100.03212.67
5.3.160.0060.03512.68
5.3.150.0050.03812.68
5.3.140.0050.03712.66
5.3.130.0050.03912.66
5.3.120.0080.03812.66
5.3.110.0100.03612.66
5.3.100.0070.03612.11
5.3.90.0040.03812.10
5.3.80.0060.03612.09
5.3.70.0020.03812.09
5.3.60.0030.03812.08
5.3.50.0110.03012.02
5.3.40.0050.03712.02
5.3.30.0060.03311.98
5.3.20.0060.03411.76
5.3.10.0030.03611.73
5.3.00.0040.04111.71
5.2.170.0070.0339.18
5.2.160.0060.0289.18
5.2.150.0080.0289.18
5.2.140.0040.0319.18
5.2.130.0060.0279.14
5.2.120.0060.0309.14
5.2.110.0050.0309.15
5.2.100.0050.0419.15
5.2.90.0070.0279.15
5.2.80.0050.0309.14
5.2.70.0050.0309.14
5.2.60.0010.0349.10
5.2.50.0040.0329.06
5.2.40.0040.0319.04
5.2.30.0040.0309.02
5.2.20.0050.0299.01
5.2.10.0080.0358.93
5.2.00.0050.0378.79
5.1.60.0010.0328.07
5.1.50.0040.0258.07
5.1.40.0030.0258.05
5.1.30.0040.0268.40
5.1.20.0040.0278.42
5.1.10.0050.0258.15
5.1.00.0070.0238.14
5.0.50.0050.0196.63
5.0.40.0030.0196.48
5.0.30.0050.0296.29
5.0.20.0040.0196.27
5.0.10.0040.0266.24
5.0.00.0060.0326.23
4.4.90.0040.0134.78
4.4.80.0060.0194.76
4.4.70.0030.0164.75
4.4.60.0010.0164.76
4.4.50.0030.0164.77
4.4.40.0040.0244.71
4.4.30.0020.0164.76
4.4.20.0030.0154.84
4.4.10.0030.0154.85
4.4.00.0030.0244.76
4.3.110.0030.0154.67
4.3.100.0020.0154.66
4.3.90.0040.0134.63
4.3.80.0030.0234.59
4.3.70.0030.0144.63
4.3.60.0020.0144.63
4.3.50.0020.0174.63
4.3.40.0020.0254.54
4.3.30.0020.0153.29
4.3.20.0040.0183.26
4.3.10.0040.0143.22
4.3.00.0000.0336.98

preferences:
49.17 ms | 401 KiB | 5 Q