未设置的元素数组键未知

时间:2013-05-27 13:14:33

标签: php arrays unset array-unset

我有以下数组输出。例如,我想取消设置索引16。 我没有设置未设置($ row [0] [16]);

但现在我不知道索引16.我怎么能用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
    )

)

1 个答案:

答案 0 :(得分:2)

使用array_search函数获取已知值的键

$key = array_search('oude prijs',$row[0]);
unset($row[0][$key]);