Skip to content

Instantly share code, notes, and snippets.

<?php
function equilib(&$arr) {
$left = array_sum($arr);
$right = 0;
foreach($arr as $index => $value) {
$left -= $value;
if ($left == $right) {
return $index;
}