Passing a class to a function...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

if I have something like, (still using PHP <5)

function c( &$obj_someclass )
    //    do more work on it

function a()
    $z = new CSomeClass
    //    work on $z
    c( $z);

I get an error 'cause function c does not know that $obj_someclass  is of
type CSomeClass
How could I do the above? or must I declare it global?


Re: Passing a class to a function...

Make sure you include the definition of CSomeClass into the php files where
the c function is declare.

Good luck!

Site Timeline