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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 09:01:29 2024 UTC