the function stream_get_meta_data
returns header as an array like this:
Array
(
[timed_out] =>
[blocked] => 1
[eof] =>
[wrapper_data] => Array
(
[0] => HTTP/1.1 200 OK
I can get the status with $meta[‘wrapper_data’][0] but how can I fetch the status code from the value which would be HTTP/1.1 200 OK as explode by HTTP/1.1 is bad idea. Is it better to use regexp to get the code? or better to use substr($meta['wrapper_data'][0], 9, 3)
?
and between /(?<!\d)[12345]\d\d(?!\d)/
and /[12345]\d\d/
is better to get status code?