0 && ($a[$move] == -1 || $a[$move] > $a[$m] + 1)) { $a[$move] = $a[$m] + 1; $queue[] = $move; } $move = $m + $bc; if ($move <= $n && ($a[$move] == -1 || $a[$move] > $a[$m] + 1)) { $a[$move] = $a[$m] + 1; $queue[] = $move; } } print $a[$n];