src/Knp/Menu/Util/MenuManipulator.php
public function moveChildToPosition(ItemInterface $item, ItemInterface $child, $position)
    {
        $name = $child->getName();
        $order = array_keys($item->getChildren());

        $oldPosition = array_search($name, $order);
        unset($order[$oldPosition]);

        $order = array_values($order);

        array_splice($order, $position, 0, $name);
        $item->reorderChildren($order);
    }
public function moveChildToPosition(ItemInterface $item, ItemInterface $child, $position)
    {
        $name = $child->getName();
        $order = array_keys($item->getChildren());

        $oldPosition = array_search($name, $order);
        unset($order[$oldPosition]);

        $order = array_values($order);

        array_splice($order, $position, 0, $name);
        $item->reorderChildren($order);
    }
Moves child to specified position. Rearrange other children accordingly.

@param ItemInterface $item
@param ItemInterface $child    Child to move.
@param integer       $position Position to move child to.