I have an error.php
file attached to ErrorHandler
that will take the error HTTP status in as a GET variable. Is there an array I can find that has a mapping of status codes to error names and descriptions, or do I have to write one myself?
An array is a data structure that stores one or more similar type of values in a single value. For example if you want to store 100 numbers then instead of defining 100 variables its easy to define an array of 100 length.
An array is a special variable that we use to store or hold more than one value in a single variable without having to create more variables to store those values. To create an array in PHP, we use the array function array( ) . By default, an array of any variable starts with the 0 index.
In PHP, there are three types of arrays: Indexed arrays - Arrays with a numeric index. Associative arrays - Arrays with named keys. Multidimensional arrays - Arrays containing one or more arrays.
It's easy to create an array within a PHP script. To create an array, you use the array() construct: $myArray = array( values );
Associative array version
$http_codes = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 103 => 'Checkpoint', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 449 => 'Retry With', 450 => 'Blocked by Windows Parental Controls', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 509 => 'Bandwidth Limit Exceeded', 510 => 'Not Extended' );
Normal array version
$http_codes = array( array(100, 'Continue'), array(101, 'Switching Protocols'), array(102, 'Processing'), array(103, 'Checkpoint'), array(200, 'OK'), array(201, 'Created'), array(202, 'Accepted'), array(203, 'Non-Authoritative Information'), array(204, 'No Content'), array(205, 'Reset Content'), array(206, 'Partial Content'), array(207, 'Multi-Status'), array(300, 'Multiple Choices'), array(301, 'Moved Permanently'), array(302, 'Found'), array(303, 'See Other'), array(304, 'Not Modified'), array(305, 'Use Proxy'), array(306, 'Switch Proxy'), array(307, 'Temporary Redirect'), array(400, 'Bad Request'), array(401, 'Unauthorized'), array(402, 'Payment Required'), array(403, 'Forbidden'), array(404, 'Not Found'), array(405, 'Method Not Allowed'), array(406, 'Not Acceptable'), array(407, 'Proxy Authentication Required'), array(408, 'Request Timeout'), array(409, 'Conflict'), array(410, 'Gone'), array(411, 'Length Required'), array(412, 'Precondition Failed'), array(413, 'Request Entity Too Large'), array(414, 'Request-URI Too Long'), array(415, 'Unsupported Media Type'), array(416, 'Requested Range Not Satisfiable'), array(417, 'Expectation Failed'), array(418, 'I\'m a teapot'), array(422, 'Unprocessable Entity'), array(423, 'Locked'), array(424, 'Failed Dependency'), array(425, 'Unordered Collection'), array(426, 'Upgrade Required'), array(449, 'Retry With'), array(450, 'Blocked by Windows Parental Controls'), array(500, 'Internal Server Error'), array(501, 'Not Implemented'), array(502, 'Bad Gateway'), array(503, 'Service Unavailable'), array(504, 'Gateway Timeout'), array(505, 'HTTP Version Not Supported'), array(506, 'Variant Also Negotiates'), array(507, 'Insufficient Storage'), array(509, 'Bandwidth Limit Exceeded'), array(510, 'Not Extended') );
You have to write this one yourself. It's easy - use http://bignosebird.com/apache/a5.shtml for reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With