Category: PHP Tutorial

python tutorials and learn python

Created with Sketch.

PHP Multidimensional Array

PHP Multidimensional Array Summary: in this tutorial, you will learn how to define a PHP multidimensional array and manipulate its elements effectively. Introduction to PHP multidimensional array Typically, you have an array with one dimension. For example: <?php $scores = [1, 2, 3, 4, 5]; Code language: HTML, XML (xml) Or <?php $rates = […
Read more

PHP foreach

PHP foreach Summary: in this tutorial, you will learn how to use PHP foreach statement to loop over elements of an array. Introduction to the PHP foreach statement PHP provides you with the foreach statement that allows you to iterate over elements of an array, either an indexed array or an associative array. The foreach…
Read more

PHP Associative Arrays

PHP Associative Arrays Summary: in this tutorial, you will learn about PHP associative arrays and how to use them effectively. Introduction to the PHP Associative Arrays Associative arrays are arrays that allow you to keep track of elements by names rather than by numbers. Creating associative arrays To create an associative array, you use the…
Read more

PHP Array

PHP Array Summary: in this tutorial, you’ll learn about PHP arrays and how to manipulate array elements effectively. Introduction to PHP arrays By definition, an array is a list of elements. So, for example, you may have an array that contains a list of products. PHP provides you with two types of arrays: indexed and…
Read more

PHP Variadic Functions

PHP Variadic Functions Summary: in this tutorial, you’ll learn about the PHP variadic functions that accept a variable number of arguments. Introduction to the PHP variadic functions So far, you’ve learned how to define functions that accept a fixed number of parameters. A variadic function accepts a variable number of parameters. The following example defines…
Read more

PHP strict_types

PHP strict_types Summary: in this tutorial, you’ll learn how to enable strict typing using the PHP strict_types directive. Introduction to the PHP strict typing Type hints allow you to declare types for function parameters and return values. For example: <?php function add(int $x, int $y) { return $x + $y; } echo add(1.5, 2.5); //…
Read more

PHP Type Hints

PHP Type Hints Summary: in this tutorial, you’ll learn how to use PHP type hints to declare the types for function parameters and return values. Introduction to PHP type hints PHP is a dynamically typed language. When you define a function, you don’t need to declare types for parameters. For example: <?php function add($x, $y)…
Read more

PHP Variable Scopes

PHP Variable Scopes Summary: in this tutorial, you’ll learn about PHP variable scopes, which specify the part of code that can access a variable. Introduction to PHP variable scopes The scope of a variable determines which part of the code can access it. The locations where the variable can be accessible determine the scope of…
Read more

PHP Named Arguments

PHP Named Arguments Summary: in this tutorial, you will learn about PHP named arguments and how to use them effectively in your code. Introduction to the PHP named arguments Since PHP 8.0, you can use named arguments for functions. The named arguments allow you to pass arguments to a function based on the parameter names…
Read more

PHP Default Parameters

PHP Default Parameters Summary: in this tutorial, you’ll learn about PHP default parameters and default parameters to simplify the function calls. Introduction to the PHP default parameters The following defines the concat() function that concatenates two strings with a delimiter: <?php function concat($str1, $str2, $delimiter) { return $str1 . $delimiter . $str2; } Code language:…
Read more