Page 1 of 1

Nested Function Calls

Posted: Tue Jun 24, 2008 7:05 pm
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?

Re: Nested Function Calls

Posted: Tue Jun 24, 2008 8:16 pm
by hitman6003

Code: Select all

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

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