advent.of.code.challenge.three.php
            
foreach($array as $command) {
    if(strstr($command, "forward")) {
        $command = intval(str_replace("forward ", "", $command));
        $forwardTotal = $forwardTotal + $command;
    } 
    elseif (strstr($command, "up")) {
        $command = (intval(str_replace("up ", "", $command)) * -1);
        $upTotal = $upTotal + $command;
    }
    elseif (strstr($command, "down")) {
        $command = intval(str_replace("down ", "", $command));
        $downTotal = $downTotal + $command;
    }
}

$depth = $upTotal + $downTotal;
$depthTimesForward = $forwardTotal * $depth;
            
        

Now, you need to figure out how to pilot this thing.

It seems like the submarine can take a series of commands like forward 1, down 2, or up 3:

Note that since you're on a submarine, down and up affect your depth, and so they have the opposite result of what you might expect.

Your horizontal position and depth both start at 0.

Puzzle Data

Calculate the horizontal position and depth you would have after following the planned course. What do you get if you multiply your final horizontal position by your final depth?