Monthly Archives: January 2013

PHP – Share Session Between Server

Basically the process is to convert the Session of Server 1, as Cookies. Then in Server 2, we convert back to Session. Just include below class in both server. Use SessionShare::encode(‘sessionpass’,’current_domain’); in Server 1 then redirect to Server 2(use header(‘Location: http://server2.com’)). Then in Server 2, include the same class, decode the Cookies that we created… Read More »

PHP – Overloading (Object, Variable, Execution, Methods)

Overloading in PHP, basically to dynamically create properties and methods I will put some samples on Overloading in Object, Variables, Execution and Methods. There’s few magic method required in Overloading; __set(), __get(), __isset(), __unset(). Overloading in Object Overloading in Variable Overloading in Execution Overloading in Methods There’s differences in Overloading Methods, because we using __call()… Read More »

PHP – __autoload() & SPL

__autoload() called anytime a new object attempts to be instantiated As a programmer, at least we need to include certain classes or files before we execute files. __autoload() will be a good place to include all required classes or files. But we only able to define only one __autoload() and this may cause problem to… Read More »

PHP – Comparison(==) VS Identity(===) Operator

$isequal = ($obj1 == $obj2); Comparison Operator(==), checks whether the two objects are the same class and whether all class variables have the same value. $issameinstace = ($obj1 === $obj2); Identity Operator(===), return true if both object variables refer to the same instance of an object.