Browsed by
Month: January 2013

UI – Bootstrap ?>

UI – Bootstrap

An easy way to setup a nice & clean UI, and responsive UI. Bootsrap use HTML5 & CSS3. Please ensure you have the following: Include the following in head Include the following at the bottom – before end of body tag – to make sure the page load fast. Here is the screen shot of my test. 🙂

PHP – Share Session Between Server ?>

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:’)). Then in Server 2, include the same class, decode the Cookies that we created to Session by calling SessionShare::decode(‘sessionpass’);. You should be able to get the same Session values, shared between two servers. 🙂

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

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() instead of __set(), __get(), __isset() and __unset() but the concept is similar. Hope all these Overloading types will give some ideas, on how to minimizing…

Read More Read More

PHP – __autoload() & SPL ?>

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 people writing third-party libraries or codes since they might have already define this __autoload(). Use spl_autoload_register() to add multiple autoloading into SPL(Standard PHP Library) Using…

Read More Read More

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

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.