-
- 20 PHP Programs
- Sum of Digits
- Even Odd
- Prime Number
- Table of Number
- Factorial
- Armstrong Number
- Palindrome Number
- Fibonacci Series
- Reverse Number
- Reverse String
- Swapping Two Numbers
- Adding Two Numbers
- Subtracting Two Numbers
- Area of a Triangle
- Area of Rectangle
- Leap Year
- Alphabet Triangle Method
- Alphabet Triangle
- Number Triangle
- Star Triangle
-
- PHP Array
- PHP Indexed Array
- PHP Associative Array
- Multidimensional Array
- PHP Array Functions
- PHP array_arsort() Function
- PHP Array asort() Function
- PHP Array changekeycase() Function
- PHP Array Chunk() Function
- PHP Array column() Function
- PHP Array combine() Function
- PHP Array compact() Function
- PHP Array count() Function
- PHP Array count_values() Function
- PHP Array current() Function
- PHP array_diff_assoc() Function
- PHP array_diff() Function
- PHP array_diff_key() Function
- PHP array_diff_uassoc() Function
- PHP array_diff_ukey() Function
- PHP array each() Function
- PHP array end() Function
- PHP array extract() Function
- PHP array_fill() Function
- PHP array_fill_keys() Function
- PHP array_filter() Function
- PHP array flip() Function
- PHP in_array() Function
- PHP array_intersect_assoc() Function
- PHP array_intersect() Function
- PHP array_intersect_key() Function
- PHP array_intersect_uassoc() Function
- PHP array_intersect_ukey() Function
- PHP array_key_exists() Function
- PHP array_key_first() Function
- PHP array_key() Function
PHP end() Function | PHP Array Functions
The end() function sets the internal pointer of an array to its last element and returns its value. This is useful when you need to access or manipulate the last element of an array.
Key Features of end()
- Moves the internal pointer to the last element of the array.
- Returns the value of the last element.
- If the array is empty, it returns
FALSE
.
Syntax of end()
Syntax
mixed end(array &$array);
Example Using end()
The following example demonstrates how end()
works:
Example
$array = ["PHP", "JavaScript", "Python", "Ruby"];
$lastElement = end($array);
echo "The last element of the array is: " . $lastElement;
Output
The last element of the array is: Ruby
← Previous Topic
array_each()
array_extract()
Next Topic →