如何更新php

时间:2018-08-22 19:18:22

标签: php arrays

我需要更新多维数组中的数组:

$newArray = ['a', 'b', 'c'];
foreach ($country as &$state){
    if($state['name']== 'Army Barrack'){
        $state['streets']== $newArray; 
    }
}

这是$country数组的第一个元素:

array (size=3) // multidimensional
  0 => 
    array (size=3)
      'name' => string 'Army Barrack' (length=12)
      'zipcode' => int 970212
      'streets' => 
        array (size=15)
          0 => string 'Adeka St.' (length=9)
          1 => string 'Ajigba St.' (length=10)
          2 => string 'Ajila St.' (length=9)
          3 => string 'Barracks Rd.' (length=12)enter code here
          4 => string 'Gungur' (length=6)

街道是我要更新的数组

0 个答案:

没有答案