468,296 Members | 1,262 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,296 developers. It's quick & easy.

calling a method from within a class??

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
2 1872
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
"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.

Similar topics

3 posts views Thread by Andrew Boothman | last post: by
4 posts views Thread by Murat Tasan | last post: by
3 posts views Thread by acg | last post: by
5 posts views Thread by Bennett Haselton | last post: by
5 posts views Thread by Nick Flandry | last post: by
8 posts views Thread by Brett Robichaud | last post: by
7 posts views Thread by =?ISO-8859-1?Q?Fernando_G=F3mez?= | last post: by
9 posts views Thread by Pubs | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.