PHP range() Function6 Jan 2025 | 1 min read The PHP range( ) function is used to create an array containing a range of elements. The PHP range( ) function returns an array of elements from low to high. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe range( ) function returns array of elements. Example 1Output: ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) Example 2Output: Array ( [0] => a [1] => b [2] => c [3] => d [4] => e [5] => f [6] => g ) Example 3Output: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, Example 4Output: ( [0] => z [1] => y [2] => x [3] => w [4] => v [5] => u ) Next TopicPhp-array-reduce-function |
The array_reduce() function is a inbuilt function of PHP. The array_reduce( ) function is used to reduce the array to a single value using a callback function. This function was introduced in PHP 4.0.5. Syntax mixed array_reduce ( array $array , callable $callback [, mixed $initial =...
1 min read
The array_key_first( ) function is used to get the first key of an array. This function was introduced in PHP 7.3.0 Syntax mixed array_key_first ( array $array ); Parameters Parameter Description Is compulsory array Specifies the array. compulsory Return Values The array_key_first( ) function returns the first key of the array if the array is not...
1 min read
The array_udiff_assoc( ) function is an inbuilt function of PHP. The array_udiff_assoc( ) function use a built-in function to compare the keys and values of two or more arrays, and returns the differences. This function was introduced in PHP 5.0. Syntax array array_udiff_assoc ( array $array1 ,...
1 min read
The array_udiff_uassoc( ) function is an inbuilt function of PHP. The array_udiff_uassoc( ) function compares two or more arrays in two user-made functions, and returns an array containing the elements from the first array. This function was introduced in PHP 5.0. Syntax array array_udiff_uassoc ( array $array1...
2 min read
PHP sort() Function The PHP sort( ) function is used to sort the array elements in ascending order. This function was introduced in PHP 4.0. Syntax bool sort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array to be sorted. compulsory Sort flags Sorting behavior. Possible type : SORT_REGULAR...
1 min read
PHP ksort() Function The PHP ksort() sorts an associative array in ascending order, according to the key. It is mainly used for an associative array. This function was introduced in PHP 4.0. Syntax bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array...
1 min read
The array_key_exists( ) is an builtin function of PHP. The array_key_exists( ) function checks an array for a specified key, and returns true if the key exists and false if the key does not exists. This function was introduced in PHP 4.0.7. Syntax array_key_exists(key,array); Parameter Description Is compulsory key Specifies the key. compulsory array Specifies...
1 min read
The count( ) function is an inbuilt function of PHP, and it is used to count the elements of an array or the properties of an object. This function was introduced in PHP 4.0. Syntax int count ( mixed $array_or_countable [, int $mode = COUNT_NORMAL ] ); Parameters Parameter Description Is...
1 min read
The array_pop() function is inbuilt function of PHP. The array_pop() function is used to remove the last element of an array. For an empty array, this function returns NULL. This function was introduced in PHP 4.0. Syntax mixed array_pop ( array &$array ); Parameters Parameter Description Required/Optional array Specifies an array. compulsory Return Type The array_pop()...
1 min read
This function is used to flip the array with the keys and values. It takes one parameter that is an array. The returned array will contain the flipped elements. The values will be the keys, and the keys will be the values. This function was...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India