How to instantiate from a string class name in PHP? -


How to create a new example of return names? Unfortunately, I get this error:

Error: Class name should be a valid object or string

This is my code:

  square fu {public function selClass () {return 'home ()'; }} $ Foo = New Foo (); $ Bar = new $ foo- & gt; Cell class ();    

It looks like you're looking for something like this:

  Class Home {Public Function Run () {Return 'Hello World'; }} Square fu {public function selClass () {return 'home'; }} $ Foo = New Foo (); $ Bar class = $ foo- & gt; Cell class (); $ Bar = new $ bar class; Revert $ Bar- & gt; Play (); // Hello World   

Note that the code you specify should be named selClass alone, without brackets, and that after bracket $ BarClass are optional.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -