Skip to content

Instantly share code, notes, and snippets.

@ultramarshall
Created November 18, 2020 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ultramarshall/2e46ae8ce28338af9e14a69e957ec641 to your computer and use it in GitHub Desktop.
Save ultramarshall/2e46ae8ce28338af9e14a69e957ec641 to your computer and use it in GitHub Desktop.
<?php
function Maksimal($arr) {
for ($i = 0; $i < (count($arr) - 1); $i++) {
$cursor = 0;
if($arr[$cursor] > $arr[$i+1]) {
$cursor = $i;
return $arr[$cursor];
}
}
}
$arr = Array(6, 21, 201, 99, 861, 1, 7, 14, 79);
print_r(Maksimal($arr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment