|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-08 14:26 UTC] colder@php.net
[2010-11-24 10:06 UTC] jani@php.net
-Type: Feature/Change Request
+Type: Documentation Problem
-Package: Feature/Change Request
+Package: Variables related
[2011-02-10 16:27 UTC] vrana@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: vrana
[2011-02-10 16:27 UTC] vrana@php.net
[2011-02-10 16:28 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 03:00:02 2025 UTC |
Description: ------------ Hi! Either its some documentation problem or a error reporting problem, but "static" and "global" can be used in the global scope, and this makes no sense? Or is it some kind of: make statics or globalize variables in a file included in a function in another file? if so, close this bugreport and eventually make some documentation for that... :) thx and greets Reproduce code: --------------- <?php error_reporting(E_ALL); # The php doc says "A static variable exists only in a local function scope" # but this does not fail in any way: static $test = 1; echo("test for static successfull\n"); # As global does only makes sense within the function, this should fail # also with some error or something: global $test2; echo("test2 for global successfull\n"); Expected result: ---------------- Any error message like "The keyword static|global is not allowed in global scope" Actual result: -------------- test for static successfull test2 for global successfull