Array
(
    [0] => Array
        (
            [0] => pan
            [1] => 3
        )

    [1] => Array
        (
            [0] => leche
            [1] => 2
        )

    [3] => Array
        (
            [0] => harina
            [1] => 1
        )

)

cantidad= 3
Array
(
    [1] => Array
        (
            [1] => galletas
            [0] => huevos
        )

    [2] => Array
        (
            [1] => chocolate
            [0] => harina
            [2] => mantequilla
        )

)

Warning: Undefined array key 0 in /home/david/public_html/pruebas.php on line 43

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/david/public_html/pruebas.php:43 Stack trace: #0 {main} thrown in /home/david/public_html/pruebas.php on line 43