Jump to content

Problem using classes.


Valrus

Recommended Posts

Ok, I'm admittedly new to php. This seems like a small thing, but it doesn't appear to work in php.

 

class mcuTransBuilder {

public $mcuToken;
public $userToken;

public $common;

function __construct() {
	//create a single Common Parameter class.
	$common = new buildCommonTrans();
	print "constructor	object created";
}

/* Sets mcu returned tokens for future transactions */
function setSessionTokens($MCU, $User) {
	print "Inside function";
	$this->common->setTokens($MCU,$User);
}

function createLogin($loginName, $password) {
	$login = new buildTrans_Login();
	return $login->buildXMLString($loginName,$password, $common);
}
}

 

Basically common is another class that is supposed to hold and do a few functions that will be used in a lot of other calls. However, for some reason when I try to call setTokens in the setSessionTokens method it just stops processing there. I can do the call in the constructor fine, but I'd really like to know why it won't do it in another method. I've tried it several different ways in terms of syntax, so I'm thinking something else is at work here.

Link to comment
https://forums.phpfreaks.com/topic/133245-problem-using-classes/
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.