cal_days_in_month() • How To Get the Number of Days in any Month of any Year?

The cal_days_in_month() function returns the number of days in a specific month of a year. This is the predefined function of PHP. cal_days_in_month() function syntax Example : – Know all the number of days in any year Print all the months’ name two dates differences Get current date and time in PHP

diff(): How To Get the Differences Between Two Dates in Days, Year & Month in PHP

The predefined method of PHP – diff() lets us calculate the difference between two dates. We can get the difference between the days of two dates, two months and also two years. This method is used as a method of the object because first, we store first date in a variable and then in that … Read more

date_create() function • Custom Date in PHP

The date_create() function of PHP is very useful when we want to create an arbitrary custom date. The date() function of PHP is for the current date and time but date_create() used to create any custom date. Whereby we can know the day name on a particular date, was that a leap year, months name, … Read more

date() function: How To Get Current Date in PHP

The date() is a function of PHP. It is used to get the current date. You have to use the date format in the date() function’s parameter as a string. This date() function/method gives you the versatility to print day, today’s date, the current date (in any format) and so more you will know further. … Read more

include_once() & require_once() functions in PHP

In this guide, I would like to tell you about include_once() and require_once() functions with examples and the differences between these two functions. The function include_once() is used to link external PHP files when we have to generate output only one time from the PHP file. Means include_once generates output at on time. If you … Read more

foreach() Loop for Ordinary Array and Associative Array in PHP

The foreach() is a looping method of PHP. It is an advanced loop. We don’t need to count the length of the array because it automatically calculates the length of an array whether it is an ordinary array or associative array. Table of Contents foreach() loop for ordinary arrayforeach() loop for associative arrayHow foreach() loop … Read more

array_keys() | How To Get Key Name of an Associative Array by Indexing Number in PHP

The function array_keys() is a predefined function of PHP. This array_keys() gives us the functionality of accessing the keys of an associative array by indexing numbers. Table of Contents Print, key name of an associative arrayPrint all key names by loopPrint all keys by indexing number of an assoc. arrayPrint all keys and their values … Read more

json_encode() | How To Convert PHP’s Associative Array to JSON Data using PHP

The json_encode() is a function of PHP. It is used to transform the associative array of PHP into JSON data (Javascript object notation). Create an associative array to change it into JSON data. Here I have created an array which is:- To transform $assoc_array into JSON data, use json_encode() function and give associative array name … Read more

json_decode() | How To Convert JSON data to PHP’s Object in PHP

In this tutorial, you are going to know, how to process JSON (Javascript Object Notation) data in PHP. The function json_decode() is used to convert the JSON object into PHP’s object. The json_decode() is a function of PHP that decodes JSON object into PHP object. To change the JSON data in an object of PHP, … Read more