PHP Exercises: Find the largest value from first, last, and middle elements of a given array of integers of odd length
104. Largest from First, Last, and Middle
Write a PHP program to find the largest value from first, last, and middle elements of a given array of integers of odd length (atleast 1).
Sample Solution:
PHP Code :
Sample Output:
1 9 9 7 8
Flowchart:

For more Practice: Solve these Related Problems:
- Write a PHP script to compare the first, middle, and last elements of an odd-length array and return the maximum.
- Write a PHP function to extract the boundary and central elements from an array and output the largest among them.
- Write a PHP program to compute and compare three key elements (first, center, last) and display the highest value.
- Write a PHP script to use conditional operators to determine the largest value among the first, middle, and last numbers in an array.
Go to:
PREV : New Array from Middle Elements.
NEXT : New Array from First Two Elements.
PHP Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.