Tag

PHP

array_map()

PHP array_map is a built-in PHP function that modifies arrays based on specific conditions. It applies a function to each element of an array and generates a new array with updated values. This article will explore its syntax, usage, and examples. Let’s see the basic pattern for it with following example. Executing this example will

Associative Arrays

The PHP associative arrays are lists or groups that already have multiple values grouped by indexes or serials. The basic array syntax would be like the below. array( … ); // or [ … ] PHP Associative Arrays Overview The associative array contains a list of values grouped by labels. So each value inside the

Spread Operator

In the world of programming, developers are always looking for ways to simplify their code and make it more efficient. The PHP spread operator is a tool that has become increasingly popular in recent years. In this article, we’ll explore the many uses of the PHP spread operator. And how it can help you write

PHP unset()

The PHP unset() function can be written as the below syntax. The output: CodedTag.com Tutorials Notice: Undefined variable: var in D:\xampp\htdocs\site-1\index.php on line 5 The unset() is a built-in PHP function used to destroy or delete the given variable. This function doesn’t return anything because it is a void type, which means there is no

Variadic Functions

Variadic functions in PHP are functions that can accept a variable number of arguments using the spread operator “…” in the function parameter. The basic syntax of a variadic function in PHP would look like the following: An Overview of PHP Variadic Functions PHP variadic functions are defined using the three dots operator before the

array_change_key_case

The basic syntax for the array_change_key_case in PHP: The array_change_key_case is a built-in PHP function used to convert the array keys into upper case or lower case and that can be done by using the flag argument. Moreover, the basic expression of the array_change_key_case callback would be like the below. The function arguments. The default

PHP strict_types

PHP type declarations or strict_types is a directive to use the strict mode for PHP type hinting which allows us to add a strict typing for function arguments values. And that can be done using the following PHP directive. declare( strict_types=1 ); In the following section, you will learn how to use the PHP strict_types

array_chunk

The PHP array_chunk syntax would be like the below. The output: Array ( [0] => Array ( [0] => Ahmed [1] => Khaled [2] => Mohamed ) [1] => Array ( [0] => Tarek [1] => Peter [2] => Michael ) [2] => Array ( [0] => Celinia [1] => Dalida ) ) The PHP

Magic Constants

PHP Magic Constants are predefined constants in PHP that provide information about the current script and its environment. They are called “magic” because they are automatically defined by PHP and can be used anywhere in your code without being declared or defined. In this article, we will explore the different PHP Magic Constants and their

PHP Boolean

When it comes to programming, the concept of Boolean values is essential. In PHP, Boolean is a data type that can hold only two values: true or false. Boolean values are used in PHP to determine the flow of execution in conditions and loops. Understanding Boolean in PHP is crucial as it helps programmers to