How to create an array for JSON using PHP?
In this article, we will see how to create an array for the JSON in PHP, & will see its implementation through examples....
read more
How to check whether a variable is null in PHP ?
We have given a variable and the task is to check whether the value of given variable is null or not and returns a Boolean value using PHP. To check a variable is null or not, we use is_null() function. A variable is considered to be NULL if it does not store any value. It returns TRUE if value of variable $var is NULL, otherwise, returns FALSE....
read more
When to use static vs instantiated classes in PHP?
Prerequisite – Static Function PHP...
read more
How to get first day of week in PHP?
Use strtotime() function to get the first day of week using PHP. This function returns the default time variable timestamp and then use date() function to convert timestamp date into understandable date....
read more
How to convert XML file into array in PHP?
Given an XML document and the task is to convert an XML file into PHP array. To convert the XML document into PHP array, some PHP functions are used which are listed below:...
read more
How to get visitors country from their IP in PHP ?
Overview: To obtain the details like country, continent, city, etc of the visitor, first we need to get the IP of the visitor. The IP address can be obtained with the help of superglobal $_SERVER in PHP. Finally, with the use of API geoPlugin, we can obtain information about the IP address i.e. visitor of the website....
read more
Top 10 Programming Languages of the World – 2019 to begin with…
If you are a newbie in the field of software development, the very first question comes to your mind is “Where to begin?” That’s undoubtedly true!...
read more
Difference between isset() and array_key_exists() Function in PHP
isset() function...
read more
Sort a multidimensional array by date element in PHP
Sorting a multidimensional array by element containing date. Use the usort() function to sort the array. The usort() function is PHP builtin function that sorts a given array using user-defined comparison function. This function assigns new integral keys starting from zero to array elements....
read more
How to remove all leading zeros in a string in PHP ?
Given a number in string format and the task is to remove all leading zeros from the given string in PHP....
read more
How to check the existence of URL in PHP?
Existence of an URL can be checked by checking the status code in the response header. The status code 200 is Standard response for successful HTTP requests and status code 404 means URL doesn’t exist....
read more
Sort array of objects by object fields in PHP
Given an array of objects and the task is to sort the array by object by given fields....
read more