advent.of.code.challenge.six.php
            
for($i = 0; $i <= 11; $i++) {
    foreach($c02 as $value) {
        $target = $value[$i];
        if($target < 1) {
            $zeroArray[] = $target;
        }
        else {
            $oneArray[] = $target;
        }
    }
    if(count($zeroArray) <= count($oneArray)) {
        $mostCommonBits[] = 1;
    }
    else {
        $mostCommonBits[] = 0;
    }
    foreach ($c02 as $value) {
        if ($value[$i] != $mostCommonBits[$i]) {
            $key = array_search($value, $c02);
            unset($c02[$key]);
        }
    }
    unset($zeroArray);
    unset($oneArray);
}

for($i = 0; $i <= 8; $i++) {
    foreach($oxygen as $value) {
        $target = $value[$i];
        if($target < 1) {
            $zeroArray[] = $target;
        }
        else {
            $oneArray[] = $target;
        }
    }
    if(count($zeroArray) <= count($oneArray)) {
        $leastCommonBits[] = 0;
    }
    else {
        $leastCommonBits[] = 1;
    }
    foreach ($oxygen as $value) {
        if ($value[$i] != $leastCommonBits[$i]) {
            $key = array_search($value, $oxygen);
            unset($oxygen[$key]);
        }
    }
    unset($zeroArray);
    unset($oneArray);
}

$c02Combined = join("", $c02);
$oxygenCombined = join("", $oxygen);
$c02Decimal = bindec($c02Combined);
$oxygenDecimal = bindec($oxygenCombined);
$final = $c02Decimal * $oxygenDecimal;
            
        

Question