Skip to content

Instantly share code, notes, and snippets.

View nick-mok's full-sized avatar

Nick Mok nick-mok

View GitHub Profile
@nick-mok
nick-mok / AnObj-v2.php
Last active May 31, 2017 20:16 — forked from Mihailoff/AnObj.php
This is a revision of George Mihailhoff's PHP Anonymous Object Class. I stumbled upon this class as I was looking for a way to attach functions to properties in a stdClass. This is not directly possible as there is no __call function inbuilt. And I found this code on a stackoverflow post that George had answered. However the implementation didn'…
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{
@nick-mok
nick-mok / AnObj.php
Last active July 8, 2024 12:02
This is a revision of George Mihailhoff's PHP Anonymous Object Class. I stumbled upon this class as I was looking for a way to attach functions to properties in a stdClass. This is not directly possible as there is no __call function inbuilt. And I found this code on a stackoverflow post that George had answered. However the implementation didn'…
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{