PHP Posts

Browse all of our latest posts here.

PHP Variables – Check if a variable is an array

In this post we will be creating PHP script that will check if an existing variable is an array, to do this we will be using the ‘is_array()’ function. See our array of items for our first example below. In the snippet of PHP code…

PHP Variables – Check if a variable is a string

In this post we will be creating PHP script that will check if an existing variable is a string, to do this we will be using the ‘is_string()’ function. For this example our variables will be stored in an array and we will carry out…

PHP Variables – Check if a variable is null

In this post we will be creating PHP script that will check if an existing variable is null, to do this we will be using the ‘is_null()’ PHP function. For this example our variables will be stored in an array and we will carry out…

PHP – Check if a string ends with a substring

In this post we will be creating a PHP script that will check if an existing string ends with a certain character or word. To do this we will be using the ‘str_ends_with()’ function which checks if a string ends with a given substring. Our…

PHP Variables – Check if a variable is a float

In this post we will be creating PHP script that will check if an existing variable is of a float type, to do this we will be using the ‘is_float()’ function. For this example our variables will be stored in an array and we will…

PHP Strings – Convert string to float

In this post we will be creating a PHP script that will convert a string to a float type. To do this we will be casting the string in to a numeric float type. See the snippet of code for how this is done.

PHP Server – Get the client IP address

In this post we will be creating a PHP script that will return the client IP address, to do this we will be using the ‘$_SERVER’ variable which contains server and execution environment information The ‘$_SERVER’ is an array and in this post we will…

PHP Date Time- Get difference in days between two dates

In this post we will be creating a PHP script that will calculate the difference in days between two given dates. To do this we will be using the date time ‘diff()’ function which returns the difference between two date time objects. See below where…

PHP Strings – Convert string to integer

In this post we will be creating a PHP script that will convert a string to an integer type. To do this we will be casting the string in to a numeric integer type. See the snippet of code for how this is done.

PHP Server – Get the current URL

In this post we will be creating a PHP script that will return the current URL, to do this we will be using the ‘$_SERVER’ variable which contains server and execution environment information The ‘$_SERVER’ is an array and in this post we will be…

PHP Variables – Check if a variable is an Integer

In this post we will be creating a PHP script that will check if an existing variable is of an integer type, to do this we will be using the ‘is_int()’ function. For this example our variables will be stored in an array and we…

PHP Arrays – Iterate the keys and values within an array

In this post we will be creating a PHP script that will iterate and print the keys and values within an array, arrays in PHP provide a means of storing multiple items in to a single variable. See our array below for this example consisting…

Loading…

Something went wrong. Please refresh the page and/or try again.