php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26334 global and static keywords
Submitted: 2003-11-20 11:40 UTC Modified: 2005-02-04 08:47 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: christian at freemails dot at Assigned:
Status: Closed Package: Website problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2003-11-20 11:40 UTC] christian at freemails dot at
Description:
------------
www.php.net/global
does not work. But a global-function exists in PHP. 

example of the global function:
function foobar() {global $foo; /* this makes $foo aviable here */}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-20 12:18 UTC] goba@php.net
There is no global() function in PHP. There is a global keyword. It is like return or continue. It is not a function. Some keywords are accessible with URL shortcuts. It might be a good idea to let global be accessed this way.

Note to the doc guys: possible to fix this by using id="language.keyword.global" and id="language.keyword.static" in the XML files.
 [2003-11-20 12:28 UTC] philip@php.net
I thought I fixed this here:
http://cvs.php.net/diff.php/phpdoc/en/language/variables.xml?r1=1.67&r2=1.68

Why doesn't the following pick this up?
<sect2 id="language.variables.scope.global">

This is related to bug #16234
 [2003-11-20 12:39 UTC] goba@php.net
Erm, the URL shortcuts and the PHP function list search only find nodes having a file named after the name of the keyword/function/control structure, etc. So modifying the ID would not be enough. As sect2s are not put onto their own pages, these need to be sect1s to get recognized by any of the quicref tools we have.

Also 'variables.scope.' is not a searched prefix, thought it can be added if need be. But still only file names are searched for, so if the file name does not contain the searched keyword, it will not be found. Since the documentation is not reindexed to make these keywords be more easy to find, the current solution is for speed reasons.
 [2004-08-05 23:33 UTC] philip@php.net
Goba, would this solve it?

Index: en/language/variables.xml
===================================================================
RCS file: /repository/phpdoc/en/language/variables.xml,v
retrieving revision 1.79
diff -u -r1.79 variables.xml
--- en/language/variables.xml   23 Jul 2004 00:18:21 -0000      1.79
+++ en/language/variables.xml   5 Aug 2004 08:09:57 -0000
@@ -374,7 +374,7 @@
    </simpara>

    <sect2 id="language.variables.scope.global">
-    <title>The global keyword</title>
+    <title id="language.keyword.global">The global keyword</title>
     <simpara>
      First, an example use of <literal>global</literal>:
     </simpara>
@@ -473,7 +473,7 @@
   </sect2>

   <sect2 id="language.variables.scope.static">
-   <title>Using static variables</title>
+   <title id="language.keyword.static">Using static variables</title>
    <simpara>
     Another important feature of variable scoping is the
     <emphasis>static</emphasis> variable.  A static variable exists

I wouldn't feel write changing the sect2 ids but maybe we have to?
 [2004-08-05 23:45 UTC] goba@php.net
No, Philip, the file is named after the sect2 id.
 [2004-09-16 17:43 UTC] vrana@php.net
I don't see a way how to solve this in the documentation. There are files only for sect1s.
 [2005-02-04 08:47 UTC] philip@php.net
The 404 handler does not allow linking to #anchors so as a  second best option both the static and global keywords are now redirected to /language.variables.scope.php

Here's the diff:
http://cvs.php.net/diff.php/phpweb/error.php?r1=1.31&r2=1.32

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 09:00:01 2025 UTC