I’m not sure, but if this doesn’t work it’s probably to avoid complex variables, this can make the php interpreter difficult, so in php7 some things have become more limited, depending on the php7 reference
Syntax of uniform variable
This change brings much greater "orthogonality" to PHP variable operators. It allows for a number of new combinations of operators that were previously not allowed and thus introduces new ways to achieve certain operations.
// nesting ::
$foo::$bar::$baz // Acessa a propriedade $baz de $foo::$bar
// nesting ()
foo()() // Executa o retorno de foo()
// Operadores em expressões incluidas semelhantes ao javascript
(function () {})() // Sintaxe IIFE do JS
The ability to arbitrarily combine variable operators came to reverse the evaluation semantics of the indirect variable, property and method references. The new behavior is more intuitive and always follows an evaluation order from left to right:
// maneira antiga // nova maneira
$$foo['bar']['baz'] ${$foo['bar']['baz']} ($$foo)['bar']['baz']
$foo->$bar['baz'] $foo->{$bar['baz']} ($foo->$bar)['baz']
$foo->$bar['baz']() $foo->{$bar['baz']}() ($foo->$bar)['baz']()
Foo::$bar['baz']() Foo::{$bar['baz']}() (Foo::$bar)['baz']()
Note that the "new way" works in older versions.
The problem seems to be the namespace, I did a test without it and created the object.
– rray
Tries the
dfinal
for goodmeucontroler()
. Thus$this->meucontroller
– Victor Morais
@Victormoral, I’m trying to create a new class, not use an object within an instance, so $this-> wouldn’t be valid in that context.
– Renan Cavalieri
@rray really, I managed to create without namespace. To create with namespace it seems and only in the gambiarra, picking up the line app controllers admin$Meucontroller() and turning into a string already with the value of $Meucontroller concatenated and create the class from the name of that string. Am I doing it wrong or is there another way?
– Renan Cavalieri