Program to Print Alphabet Triangle Using range() Function in PHP. A Php program to alphabet triangle using range() method. The range() function is a PHP built-in function that creates an array of elements of any kind, such as integers and alphabets, within a particular range (from low to high), i.e. the list’s first entry is considered low and the last element is considered high. array range is the syntax.
$alpha = range('A', 'Z');
for($i=0; $i<5; $i++)
for($j=5; $j>$i; $j--)
range() Function in PHP
The range() function returns an array with a specified number of entries. This function returns an array of elements arranged in ascending order from low to high. The range array will be from high to low if the low value is greater than the high parameter. The range() method in PHP is used to produce an array of elements of any type, such as integers or alphabets, within a particular range, where the first element of the list is considered low and the last element is considered high.
For Loop in PHP
A loop is used to repeatedly execute a set of statements until a certain condition is met. When showing numbers from 1 to 100, for example, you might wish to set the value of a variable to 1 and display it 100 times, raising its value by 1 with each loop iteration.
Echo Function in PHP
echo is a statement that displays the output of a command. echo() and echo can be used with or without parentheses. echo does not produce a result. In echo, several strings can be separated by a comma (,). The echo statement is quicker than the print statement.
Dollar Symbol in PHP
$x is a regular variable with the name x that can hold any type of value, including strings, integers, floats, and so on. The $x variable is a reference variable that stores a value that may be accessed by typing $ before the $x value.