Highest element in array
<?php
// Sample array
$numbers = [5, 10, 8, 3, 15, 7];
// Find the maximum element without using max function
$maxElement = $numbers[0]; // Assume the first element is the maximum
foreach ($numbers as $number) {
if ($number > $maxElement) {
$maxElement = $number; // Update the maximum element if a larger one is found
}
}
echo "The maximum element in the array is: $maxElement";
?>