Php | Learn for Master
  • Learn PHP by Examples

    In this tutorial, I will walk through the most popular examples to learn PhP. The topics includes simple php example, php get and post methods,  php arrays,  and php object.

    PhP hello word

    Here the echo keyword is used to print out the html string on your browser. 

    Get system information from PHP

    <?php phpinfo(); ?>

    Get Client’s browser information

    $_SERVER is a special reserved PHP variable that contains all web server information. It is known as a superglobal.
    A possible output might be:

    Mozilla/4.0 (compatible; MSIE 6.0;

    [Read More...]
  • PHP sort Arrays

    In the previous tutorial, we have used examples to learn PHP arrays.  In this post, we talk about how to sort php Arrays based on different needs.

    Here are the functions we can use to sort a PHP array:

    • rsort() Sorts an indexed array in descending order   
    • sort() Sorts an indexed array in ascending order
    • arsort() Sorts an associative array in descending order, according to the value
    • asort() Sorts an associative array in ascending order, according to the value
    • krsort() Sorts an associative array in descending order,
    [Read More...]
  • Learn PHP Arrays by Examples

    In this post, I will use examples to show how to use PHP arrays. I will first describe the concept of PhP arrays, how to create an array, how to get access to and update the values in an array, and how to loop a php array.  I also use examples to show how to load a csv file into a php array and describe some of the useful functions to process an array. 

    What is PHP Array

    An array in PHP is actually an ordered map that associates values to keys. This type is optimized for several different use cases.  

    [Read More...]