Advent of code 2015/2
Ajax Direct

Answer

Part 1 :
Part 2 :
// ==================================================
// > PART 1
// ==================================================
$solution_1 = $input->lines->reduce(function ($total, $line) {
    $dim = $line->numbers();

    $a = $dim[0] * $dim[1];
    $b = $dim[1] * $dim[2];
    $c = $dim[0] * $dim[2];

    return $total + (2 * $a) + (2 * $b) + (2 * $c) + min($a, $b, $c);
}, 0);

// ==================================================
// > PART 2
// ==================================================
$solution_2 = $input->lines->reduce(function ($total, $line) {
    $dim = $line->numbers()->sort()->values();
    return $total + (($dim[0] * 2) + $dim[1] * 2) + $dim->multiply();
}, 0);