I\'m coming from the C# world and has just started doing a little PHP coding, so I was wondering if it is possible to use events on PHP, or if it is planned to include this
You can create something like event handling class in PHP :
class Event {
protected $_eventCallbacks = array();
function addEventCallback($callback) {
$this->_eventCallbacks[$callback] = $callback;
}
function removeEventCallback($callback){
if(isset($this->_eventCallbacks[$callback])){
unset ($this->_eventCallbacks[$callback]);
}
}
function cleanEventCallback(){
foreach ($this->_eventCallbacks as $callback) {
unset ($callback);
}
}
function fireEvent() {
foreach ($this->_eventCallbacks as $callback) {
call_user_func($callback);
}
}
}
This code was taken from here http://setahost.com/php-events-singletone-and-factory-pattern-application/ There is also good example of modular and sub modular application using this class .