Categories
PHP

Including external files

PHP uses four directives that can be used to include another PHP file in a currently running script.

Categories
PHP

Variable Scope

How to use use variables declared outside the function?

Categories
PHP

Arrow and Anonymous Functions

In this tutorial we’ll use and compare anonymous and arrow functions.

Categories
PHP

Passing variables by reference to a function

By default, variables are passed to functions by value. To pass variables by reference, prefix the variable with & (ampersand) character: &$var. Referencing with the ampersand can also be used when assigning variables.

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.