Changing values of a two-dimensional array - PHP

1

Hello.

I need to mount a foreach to update the array values below:

Array
(
   [0] => Array
       (
        [id] => 1
        [profissao] => Ajudante de cozinha
        [interesse] => 
       )

   [1] => Array
       (
        [id] => 2
        [profissao] => Manobrista
        [interesse] => 
       )

   [2] => Array
       (
        [id] => 3
        [profissao] => Porteiro
        [interesse] => 
       )

   [3] => Array
       (
        [id] => 4
        [profissao] => Vigia
        [interesse] => 
       )

   [4] => Array
       (
        [id] => 5
        [profissao] => Zelador
        [interesse] => 
       )

   [5] => Array
       (
        [id] => 6
        [profissao] => Arrumadeira
        [interesse] => 
       )

   [6] => Array
       (
        [id] => 7
        [profissao] => Babá
        [interesse] => 
       )

   [7] => Array
       (
        [id] => 8
        [profissao] => Babá folgista
        [interesse] => 
       )

   [8] => Array
       (
        [id] => 9
        [profissao] => Caseiro
        [interesse] => 
       )

   [9] => Array
       (
        [id] => 10
        [profissao] => Copeira(o)
        [interesse] => 
       )
)
    
asked by anonymous 09.02.2015 / 23:39

1 answer

2

You can scroll through it like this:

foreach($myArray as $key => $subarray) {
      $myArray[$key]['interesse'] = '1';
      // ...
}

DEMO

    
09.02.2015 / 23:53