Jump to content

Accessing 'Parent'


Mschumi

Recommended Posts

Hey there, well I've been off coding for a good year at least and I've forgotten / lost something out of my brain. Anyway, in PHP4 I use to be able to do this...

 

function new_class($cName, $file) {

	require $file.'.php';
	$this->$cName = new $cName();
	$this->$cName->cp = $this;

}

 

That would be in my master class, then inside the new class I just made, I would be able to access other classes like so...

 

$this->cp->somClass->aFunction

 

However it seems the below line doesn't do anything

 

$this->$cName->cp = $this;

 

Solution?

Link to comment
https://forums.phpfreaks.com/topic/195952-accessing-parent/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.