Originally posted by Shrike
Hmm I think that is called a circular reference - not sure though. You are storing the instance of sub in the instance of MyClass and yet passing the instance of MyClass to sub. Wacky 🙂
As for the problem - I see that you are using PHP 5. PHP 5 passes objects by reference by default - so any changes you make on the original will be reflected in the reference (passed to the sub instance).
Yes but is there any way to make PHP4 do that too?
edit://
let me try to explain why i want it.
i'm working on a class to resize image.
$image->gd->resize(..);
is how i want to call the functions
but here is a
$image->setup(); function with this the user can set if he want interlaced, and other options
so would like to be able to get those settigns form inside the gd class, becouse theu can change. small example:
$img = new image;
$img->setup('/bin/convert', true, 100);
$MyImage = $img->gd->load('myfile.jpg');
$MyImage = $img->gd->resize($MyImage, 50%);
$img->gd->save($MyImage, 'MyImage_hightQ.jpg');
$img->setup('/bin/convert', false, 50);
$img->gd->save($MyImage, 'MyImage_LowQ.jpg');
i got this working fine under php5, but my prodoction server is a php4 :/