Categories
PHP

Defining Functions

User-defined functions help you create organized and reusable code. They provide a way to group together related statements into a cohesive block. For reusable code, a function saves duplicating statements and makes maintenance of the code easier.

Categories
PHP

Converting numbers between decimal, binary, octal, and hexadecimal

PHP provides the following functions that convert numbers between integer decimal and the commonly used number systems, binary, octal, and hexadecimal.

Categories
PHP

Generating a random number

PHP provides the rand( ) and mt_rand() functions, which returns values from a generated sequence of pseudo-random numbers. The srand( ) and mt_srand() functions seed the algorithm and need to be called before the first use of the rand( ) or mt_rand() functions in a script to return the same random numbers each time a script is called.

Categories
PHP

Ceil, Floor, and Round

Rounding float values up or down with ceil, floor, and round functions.

Categories
PHP

Find absolute, lowest, or highest value

How to find the absolute value of a number and find the minimum or maximum value from a set of mixed values.

Categories
PHP

The DatePeriod Class

Learn how to generate date or time ranges with the help of DatePeriod class.

Categories
PHP

The DateInterval Class

How to add or subtract a date/time period from a DateTime object using the add() and sub() methods.

Categories
PHP

The DateTimeZone Class

This tutorial describes how to represent times in different parts of the world.

Categories
PHP

The DateTime Class

The DateTime class deals with a wide range of date and time calculations, it provides an object-oriented interface to accurately create and manipulate dates and times.

Categories
PHP

Calculating Dates

Learn how to calculate the difference between two date and time strings. Also, how to find the leap year from a list of years.