Bug #72137 [Opn->Nab]: Backward variable handling ain't working accourding to doc
| From: | requinix@php.net | Date: | Mon, 02 May 2016 08:04:19 +0000 |
| Subject: | Bug #72137 [Opn->Nab]: Backward variable handling ain't working accourding to doc | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13441@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72137&edit=1
ID: 72137
Updated by: requinix@php.net
Reported by: dutchprogrammer at gmail dot com
Summary: Backward variable handling ain't working accourding
to doc
-Status: Open
+Status: Not a bug
Type: Bug
Package: Documentation problem
Operating System: centos 7 (linux)
PHP Version: 7.0.6
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
> Code that used the old right-to-left evaluation order must be rewritten to
> explicitly use that evaluation order with curly braces (see the above middle
> column).
$foo->{$bar['baz']}()
$class->{$urlSplit[1]}($param1, $params2);
Previous Comments:
------------------------------------------------------------------------
[2016-05-02 07:53:51] dutchprogrammer at gmail dot com
Description:
------------
Accourding to the 'Changes to variable handling'
(http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect),
arrays that i want to pass as function name i have to write as ($foo->$bar)['baz']()
In my case i have an api that check the url wich class and function needed to be loaded for example
(in short):
url: users/getData
i split the url with explode on '/' and then pass the second url key [1] as a function:
$url = 'users/getData';
$urlSplit = explode('/', $url, 2);
($class->$urlSplit)[1]($param1, $params2);
It's weird to write it like this but this ainât working.
I need to save the function to a new variable to fix it like this:
$function = $urlSplit[1];
$class->$function($param1, $params2);
Test script:
---------------
Explained in the description above
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72137&edit=1