note 114428 added to language.types.object

From: Date: Wed, 19 Feb 2014 18:51:10 +0000
Subject: note 114428 added to language.types.object
Groups: php.notes 
Request: Send a blank email to php-notes+get-198553@lists.php.net to get a copy of this message
Class like stdClass but with the possibility to add and execute function. class stdObject { public function __construct(array $arguments = array()) { if (!empty($arguments)) { foreach ($arguments as $property => $argument) { if ($argument instanceOf Closure) { $this->{$property} = $argument; } else { $this->{$property} = $argument; } } } } public function __call($method, $arguments) { if (isset($this->{$method}) && is_callable($this->{$method})) { return call_user_func_array($this->{$method}, $arguments); } else { throw new Exception("Fatal error: Call to undefined method stdObject::{$method}()"); } } } ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/language.types.object.php Edit -- https://master.php.net/note/edit/114428 Del: integrated -- https://master.php.net/note/delete/114428/integrated Del: useless -- https://master.php.net/note/delete/114428/useless Del: bad code -- https://master.php.net/note/delete/114428/bad+code Del: spam -- https://master.php.net/note/delete/114428/spam Del: non-english -- https://master.php.net/note/delete/114428/non-english Del: in docs -- https://master.php.net/note/delete/114428/in+docs Del: other reasons-- https://master.php.net/note/delete/114428 Reject -- https://master.php.net/note/reject/114428 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198553) next »