Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Calling function of a Class in a Class....

jackfurrjackfurr Member Posts: 1
What is the proper sytax for calling a function of a member variable for a class?


class Foo
function test()
return "OK";

class Bar
var $foo = new Foo

function test()
// This doesn't work.
return $this->foo->test();

I can't subclass because I have multiple class's as member variables and PHP does not support multiple inheritence.


- jack -


  • SouldrinkerSouldrinker Member Posts: 143
    Don't know this for sure, but I guess there is no way to do what you want to do. I guess you have to wait for PHP with zend 2 - there class-Functions will get better.

    best regards,

    sebastian mohrenstecher
    executive secretary
    [email protected]

  • Shawn CarterShawn Carter Member Posts: 0

    _______ | | free video tutorials and ebooks about // Perl, C, Visual Basic .NET, Objective-C, Python, C++, Delphi, MATLAB, R, Java, JavaScript, PHP, PL/SQL, Swift, Visual Basic, Assembly, Scratch, Go, Ruby, C# Transact-SQL, Crystal, Awk, Lisp, Clojure, LabVIEW, VBScript, F#, ABAP, Bash, COBOL, Scala, Fortran, Kotlin, Rust, Logo, D, Prolog, Scheme, Erlang, Alice, Dart, Lua, SAS, Apex, FoxPro, Julia, Hack, Ada, ML // ___

Sign In or Register to comment.