PHP Adjacent Elements Product
function adjacentElementsProduct($inputArray)
{
$max = PHP_INT_MIN;
for ($i = 0, $c = count($inputArray); $i < $c - 1; $i++) {
$max = max($max, $inputArray[$i] * $inputArray[$i + 1]);
}
return $max;
}
This walks through neighboring values, multiplies each pair, and keeps the biggest product it finds.