Req #62169 [Opn]: Use 'global' like a language structure
| From: | valentiny510 at yahoo dot es | Date: | Sat, 02 Jun 2012 01:01:49 +0000 |
| Subject: | Req #62169 [Opn]: Use 'global' like a language structure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170987@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62169&edit=1
ID: 62169
User updated by: valentiny510 at yahoo dot es
Reported by: valentiny510 at yahoo dot es
Summary: Use 'global' like a language structure
Status: Open
Type: Feature/Change Request
Package: *Programming Data Structures
Operating System: Windows XP
PHP Version: 5.4.3
Block user comment: N
Private report: N
New Comment:
Imagine I have unset the, ( $GLOBALS )..
To access a 'global' object into the function, first must be called trowght global..
function test()
{
global $object;
return $object->some_method( );
}
I wonder if is posible to use (in the future :P) the 'global' like other language
structures.. Ex:
function test()
{
return( global $object->some_method( ) );
}
I know ... you will ask me why not use the namespaces, reflections, references, traits, or
whatever.. but .. its not the point ...
Previous Comments:
------------------------------------------------------------------------
[2012-06-02 00:59:13] valentiny510 at yahoo dot es
In the first line I just wrote: "Imagine I have unset the ($GLOBALS)"
for some reason.. (is ugly, security, memory consumption, the host provider doesn't allow) or
who knows why ...
I know how it works for now but the question is not about how to use "$GLOBALS".
anyway, thanks for the time spent to answer
------------------------------------------------------------------------
[2012-05-30 13:35:41] riptide dot tempora at opinehub dot com
For now:
<?php
function test()
{
return( $GLOBALS['object']->some_method( ) );
}
?>
------------------------------------------------------------------------
[2012-05-26 20:31:16] valentiny510 at yahoo dot es
Description:
------------
Imagine I have the, unset ( $GLOBAL )..
To access a 'global' object into the function, first must be called trowght global..
function test()
{
global $object;
return $object->some_method( );
}
I wonder if is posible to use (in the future :P) the 'global' like other language
structures.. Ex:
function test()
{
return( global $object->some_method( ) );
}
I know ... you will ask me why not use the namespaces, reflections, references, traits, or
whatever.. but .. its not the point ...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62169&edit=1