Sunday, August 20, 2017

Tower of Hanoi with PHP


The Tower of Hanoi (a.k.a Tower of Brahma and Lucas' Tower) is a mathematical game or puzzle.

The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
            1. Move only one disk at a time.
            2. A larger disk may not be placed ontop of a smaller disk.
            3. All disks, except the one being moved, must be on a peg.

Friday, August 11, 2017

Convert Number To Text


Convert Latin number to English text:

Convert Latin number to Khmer text:

Thursday, August 10, 2017

Recursive Function in PHP


A recursive function (DEF) is a function which either calls itself or is in a potential cycle of function calls. Check example below:

We will implement recursive function with below data:


Create function that be able so select all above data into valid hierarchy format:

Create one more function to display data from that hierarchy array:

Tuesday, August 8, 2017

Using === instead of ==


The == (or !=) operator performs an automatic type conversion if needed. The === (or !==) operator will not perform any conversion. It compares the value and the type, which could be considered faster than ==.

Monday, August 7, 2017

Redirect to www with https and http in htaccess


Redirect to www with https

Redirect to www with http