Add constant to each key of an array

1

How to include a constant in a particular key of each array. Example:

Array without change:

   array (size=3)
  0 => 
    array (size=3)
      'id' => string '1' (length=1)
      'image' => string '1.jpg' (length=5)
      'carro' => string 'bmw' (length=12)
  1 => 
    array (size=3)
      'id' => string '2' (length=1)
      'image' => string '2.jpg' (length=5)
      'carro' => string 'mercedes' (length=17)
  2 => 
    array (size=3)
      'id' => string '3' (length=1)
      'image' => string '3.jpg' (length=5)
      'carro' => string 'bentley' (length=9)

Array with change:

array (size=3)
  0 => 
    array (size=3)
      'id' => string '1' (length=1)
      'image' => string 'http://exemplo.com/1.jpg' (length=5)
      'carro' => string 'bmw' (length=12)
  1 => 
    array (size=3)
      'id' => string '2' (length=1)
      'image' => string 'http://exemplo.com/2.jpg' (length=5)
      'carro' => string 'mercedes' (length=17)
  2 => 
    array (size=3)
      'id' => string '3' (length=1)
      'image' => string 'http://exemplo.com/3.jpg' (length=5)
      'carro' => string 'bentley' (length=9)
    
asked by anonymous 18.01.2018 / 01:28

0 answers