Very simple question here. Doing my first OO programming in PHP, more used to Java & C#.
With this class definition:
class RouteParser {
var $DEBUG = 1;
function parse($from, $to, $route){
debug("test");
debug("test again");
}
function debug($arg) {
if($DEBUG) {
echo "<pre>DEBUG: " . print_r($arg) . "</pre>";
}
}
}
And this executing code:
include("RouteParser.php");
$rp = new RouteParser();
$return = $rp->parse("from","to","test");
I'm getting the error:
Fatal error: Call to undefined function debug() in C:\xampplite\htdocs\routeparse\RouteParser.php on line 7
PHP doesn't support function prototypes as far as I can tell, so I'm stumped on how to tell one class function that another class function exists... according to what I found on the PHP documentation, this is only an issue if the function is inside a conditional (which makes sense)...