从数组PHP获取指定的值

时间:2016-12-25 13:46:46

标签: php arrays

我有这种数组

$data["products"] =
Array
(
    [0] => Array
        (
            [productId] => 1
            [productName] => Automatishen Here
            [productDescription] => Before you go banging your head on a wall, have you checked to make sure that this extra is actually installed on your site?
            [productPicture] => 
            [productSubText] => sub-text
            [productTaxonomie] => 1
            [productDateTime] => 2016-12-23 06:49:42
            [isbnNumber] => 1234
            [productIsbn] => 1
            [taxonomieName] => Proba
        )

    [1] => Array
        (
            [productId] => 2
            [productName] => Automatishen Here
            [productDescription] => Before you go banging your head on a wall, have you checked to make sure that this extra is actually installed on your site?
            [productPicture] => 
            [productSubText] => sub-text
            [productTaxonomie] => 1
            [productDateTime] => 2016-12-23 06:49:42
            [isbnNumber] => 456
            [productIsbn] => 3
            [taxonomieName] => Proba
        )

);

在所有值[taxonomieName]中都是相同的,我不想预先知道那个数组,因为它是超载的。我只需要一个来自该数组的[taxonomieName]

$ name = [taxonomieName];

1 个答案:

答案 0 :(得分:3)

既然一切都一样,你可以抓住第一个,对吗?

$data['products'][0]['taxonomieName']