Category: PHP

PHP echo() Function

The echo() function outputs one or more strings. Note: The echo() function is not actually a function, so you are not required to use parentheses with it. However, if you want to pass more than one parameter to echo(), using parentheses will generate a parse error. Example Output

PHP array_pad() Function

The array_pad() function is used to padding (insert) a specified number of elements, with a specified value, into an array. Tip: If you assign a negative size parameter, the function will insert new elements BEFORE the original elements (See example below). Note: This function will not delete any elements if the size parameter is less […]

PHP chop() Function

The chop() function is used to remove the whitespaces and other predefined characters from the right side of a string. This function is an alias of rtrim() function. Example Output

PHP array_replace_recursive() Function

The array_replace_recursive() function replaces the values of the first array with the values from following arrays recursively. Tip: You can assign one array to the function, or as many as you like. Note: If you do not specify a key for each array, this function will behave exactly the same as the array_replace() function. Parameter […]

Shopping Cart using Laravel 5

In this tutorial, we are going to implement the shopping cart functionality in laravel 5 and use package. The package project is on GitHub LaravelShoppingcart. Let’s implement a practical example of an e-commerce website that has shopping cart functionality. To be clear, we will be using an existing composer package that already has shopping cart […]

How to use the query string in PHP?

Have you ever seen a URL which looked like www.example.com/page.php?mode=1&style=red? Well, this page is being passed variables and their values through the query string, here the variables mode and style are being passed, with values 1 and red respectively. The question mark ?indicates the start of the query string and the ampersand, &, symbol separates variable=value assignments. The page is then able to read these variables and […]