Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Mok nick-mok

View GitHub Profile
@nick-mok
nick-mok / AnObj-v2.php
Last active May 31, 2017 — 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'…
View AnObj-v2.php
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{
@nick-mok
nick-mok / AnObj.php
Last active Jan 2, 2020
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'…
View AnObj.php
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{