php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34768 Global keyword
Submitted: 2005-10-07 01:13 UTC Modified: 2005-10-07 09:35 UTC
From: victorepand at hotmail dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.4.0 OS: Linus
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: victorepand at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-10-07 01:13 UTC] victorepand at hotmail dot com
Description:
------------
I wonder if the PHP designers could make it possible to apply an array of variable names to the GLOBAL keyword without using a loop. For example:

function global_in_here() {
   $names=array("var1","var2","var3");
   global array_to_variable_list($names); # what function would be used here to convert the array to a variable list?

 }

 rather than:

 function global_in_here() {
   $names=array("var1","var2","var3");
   foreach($names AS $name) global $$name;

 }

Thanks,
 Victor Epand, Owner
 Krishna Design


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-07 09:35 UTC] derick@php.net
As it is bad practise to use globals in the first place, we will not add this feature.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 14:01:33 2025 UTC