Вопрос

I have the following array output. For example i want to unset index 16. I do unset unset($row[0][16]);

But now i dont know the index 16. How can i unset it by ifelse "oude prijs" ?

Array
(
[0] => Array
    (
        [0] => productname
        [1] => price
        [2] => description
        [3] => producturl
        [4] => imageurl
        [5] => weight
        [6] => category
        [7] => merk
        [8] => ontwerper
        [9] => afmetingen
        [10] => levertijd
        [11] => garantie
        [12] => secondarycategories
        [13] => laagsteprijsgarantie
        [14] => verzendkosten
        [15] => productcode
        [16] => oude prijs
        [17] => ID
        [18] => status
    )

)
Это было полезно?

Решение

Use array_search function to get the key of the known value,

$key = array_search('oude prijs',$row[0]);
unset($row[0][$key]);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top