note 13359 added to language.oop.php
| From: | ntunali at isbank dot net dot tr | Date: | Wed, 13 Jun 2001 13:02:35 +0000 |
| Subject: | note 13359 added to language.oop.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14428@lists.php.net to get a copy of this message | ||
Event Driven!!!!!!!
<?
// ============ your class (anywhere) =======================
class a {
var $t;
function lets_call() {
if (!empty($this->t))
call_user_func($this->t);
}
}
//================= your codes ===============================
$new_class=new a;
function ex_one(){
echo 'ex_one function' .'<br>';
}
function ex_two() {
echo 'ex_two function'.'<br>';
}
$new_class->t='ex_one';
$new_class->lets_call();
$new_class->t='ex_two';
$new_class->lets_call();
// ==================== That's all ==============================
?>
http://www.php.net/manual/en/language.oop.php