By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,746 Members | 1,849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,746 IT Pros & Developers. It's quick & easy.

calling a method from within a class??

P: n/a
hi all,

just wondering what the syntax is for calling a method of a class from
another method of that same class?

for example...

class Test {
var $test="foo";
function printTest() {
print $this->test;
}
function callMethod() {
// call the printTest() function
}
}

what is the code i need to put in the callMethod() method to call the
printTest() method???

thanks in advance

JP
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
kingofkolt wrote:
just wondering what the syntax is for calling a method of a class from
another method of that same class?

for example...

class Test {
var $test="foo";
function printTest() {
print $this->test;
}
function callMethod() {
// call the printTest() function
}
}

what is the code i need to put in the callMethod() method to call the
printTest() method???


$this->printTest();

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #2

P: n/a
"Chris Hope" <bl*******@electrictoolbox.com> wrote in message
news:40********@news.athenanews.com...
kingofkolt wrote:
just wondering what the syntax is for calling a method of a class from
another method of that same class?

for example...

class Test {
var $test="foo";
function printTest() {
print $this->test;
}
function callMethod() {
// call the printTest() function
}
}

what is the code i need to put in the callMethod() method to call the
printTest() method???


$this->printTest();

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/


well that was simple enough... thx!!

JP
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.