PHP Tutorials

How to improve web page speed in Mobile

There are several benefits of website page speed optimization. Fast sites rank better in search engines. Google has specifically stated that one of their ranking factors is site performance, especially for mobile users. Speed optimization reduces server load. A fast website increases conversions. Fast page loads make happy customers, and happy customers buy more. To improve page speed in mobile, please follow below very easy steps before make website live. …

Continue reading

Get only URL of the Previous and Next Post in WordPress

When we want to configure links between a blog’s next and previous pages, there is absolutely no function to return ONLY the URLs of the next and previous pages. To save the time below simple thing will help. To return the URL of the previous page, use the following php code: To return the URL of the next page, use the following php code: To use them, simply echo the …

Continue reading

How to get week dates from week number and year

In this tutorial I will show you how to get week dates from week number and year. We will calculate ISO week number (1-53) and represent the start of the week “Monday”. There is a setISODate() method with DateTime extension that accepts the year (4-digit year) and ISO week number. Example of get week dates from week number and year The output of above code is following:  

How to capture screenshot of website from URL in PHP

In this tutorial, I will show you how to capture screenshot of any website from URL in PHP. There are so many third party APIs are available to capture screenshot of the website using PHP script. In the following example, I am using Google API to capture screenshot from given url. You can easily capture the screenshot using Google APIs. There are many reason to capture screenshot of website to …

Continue reading

How to Remove Special Character from String in PHP

In this tutorial I will show you how to remove special character from string in PHP. Sometimes we need to remove all special characters by using preg_replace from input string. There are two option available to remove special character from string using php. Option 1: Using preg_replace PHP Function We can remove special character from sting using preg_replace, it’s using regular expression to special character from string. Syntax of preg_replace …

Continue reading

How to Remove Duplicates from Multidimensional Array

In this tutorial I will show you how to remove duplicates from multidimensional array in PHP. array_unique() function works on single dimensional array not on multidimensional arrays. After googling I have found a way to get unique multidimensional array using serialization of array. Serialization is used to storing or passing PHP values around without losing their type and structure. Steps to remove duplicates from multidimensional array 1. We will use …

Continue reading

Create Dynamic Tree View Menu with PHP, MySQL, CSS

In this tutorial I will describe how to create dynamic tree view menu with PHP, MySQL, CSS. If you want to display menu items as a tree view structure following tutorial will help you. Steps to generate tree view menu: Step 1: First we need to create a table ‘items’ in MySQL database. This table contains four column, The column id is the item id and name is the item …

Continue reading