note 33809 added to ref.classobj
| From: | zidsu at rack1 dot php dot net | Date: | Tue, 08 Jul 2003 10:24:33 +0000 |
| Subject: | note 33809 added to ref.classobj | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51687@lists.php.net to get a copy of this message | ||
FYI: if you want to split your class into manageble chunks, what means different files for you, you
can put you functoins into includes, and make include() have a return value. Like this:
class Some_class {
var $value = 3;
function add_value ($input_param) {
return include ("path/some_file.php");
}
}
And your included file:
$input_param += $this->value;
return $input_param;
Then your function call will be:
$instance = new Some_class ();
$instance->add_value (3);
And this will return
6
hopefully :P
Keep in mind though, that the scope in the included file will be identical to the scope the function
'add_value' has.
And if you want to return the outcome, you should also have a return statement made in your include
as well.
----
Manual Page -- http://www.php.net/manual/en/ref.classobj.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33809
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33809&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33809&report=yes