Nested Function Calls

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hyp3rk1d
Forum Newbie
Posts: 1
Joined: Tue Jun 24, 2008 7:04 pm

Nested Function Calls

Post by hyp3rk1d »

I can't figure this out...

<?php
class test
{
var count;

var countTest;

function read()
{

do a bunch of stuff

if(AsfdasDF)

testDoThis();

}

function testDoThis()
{

do all this stuff

}
}

?>

Then I have another script it order to run the read function will should in turn run all the other functions(kinda like the main function if this were java)

This script looks like this:

<?php

include (/test.php)

read();

?>


But When I try to do this I get an error that says when it tries to run read() the function testDoThis() does not exist?? I am fairly new to php. Any help is appreciated or example sites?
hitman6003
Forum Newbie
Posts: 4
Joined: Mon Jun 23, 2008 7:36 pm

Re: Nested Function Calls

Post by hitman6003 »

Code: Select all

function read() {
  //do a bunch of stuff
  if(AsfdasDF)
    $this->testDoThis();
  }
Scope...

http://www.php.net/language.variables.scope
Post Reply