Hey guys. I've been struggling with this for a few hours now. Basically, here's what i want to do (it's really quite simple):
I have a class myClass and in it are functions. I'm deconstructing it and making it more accessible by only using functions for what they're used for and nothing else. i.e.
<?php
class myClass
{
var $dir;
var $error;
var $output;
var $files;
function get_files(){
// This function gets all the files in a directory
// If error, throw_error('Error', 'Message') is called
if(!$handle){ throw_error('Error', 'Can\'t open the directory!'); }
}
function throw_error($err, $msg)
{
$this->error = $err.'<br>'.$msg;
return $this->error;
}
}
?>
Unfortunately this doesn't work. I am wondering how i can call a function from within the same class so I don't have to use the outside script to do it. LIke:
$m = new myClass();
$m->get_files();
$m->throw_error('','');
Any ides? I know about using teh parent class, but I don't have a parent class, I have just one class. Any ideas would be hlepful.
~Brett