|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-08-11 16:19 UTC] txino at malon dot org
Description: ------------ The $http_response_header variable i not global nor superglobal. It seems like a local variable that is created in the same context you call "file_get_contents" or similar. I don't understand why the documentation does not explain this. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 11:00:01 2025 UTC |
The variable $http_response_header is an array which is created in the local scope. <?php function a() { echo 'In scope : Before : ', (isset($http_response_header) ? 'Exists' : 'Does not exist'), PHP_EOL; file_get_contents('http://www.google.com'); echo 'In scope : After : ', (isset($http_response_header) ? 'Exists' : 'Does not exist'), PHP_EOL; } echo 'Out of scope : Before : ', (isset($http_response_header) ? 'Exists' : 'Does not exist'), PHP_EOL; a(); echo 'Out of scope : After : ', (isset($http_response_header) ? 'Exists' : 'Does not exist'), PHP_EOL; ?> outputs ... Out of scope : Before call : Does not exist In scope : Before call : Does not exist In scope : After call : Exists Out of scope : After call : Does not exist