title: How to do array walk with the dynamic variable?
body: <pre><code> array (size=2)
   0 =&gt; 
   array (size=7)
    'id' =&gt; string '66' (length=2)
    'room_name' =&gt; string 'Luxury' (length=6)
    'no_of_room' =&gt; string '0' (length=1)
    'price' =&gt; string '1000' (length=4)
    'description' =&gt; string 'dfh dvsrtruub  dsgd' (length=19)
    'image' =&gt; string 'arrow.jpg' (length=9)
    'hotel_id' =&gt; string '1' (length=1)
   1 =&gt; 
   array (size=7)
    'id' =&gt; string '65' (length=2)
    'room_name' =&gt; string 'Deluxe' (length=6)
    'no_of_room' =&gt; string '4' (length=1)
    'price' =&gt; string '800' (length=3)
    'description' =&gt; string 'rybsvssfd' (length=9)
    'image' =&gt; string '2P2Z4.png' (length=9)
    'hotel_id' =&gt; string '1' (length=1)
  </code></pre>
  
  <p>hi this is array when i do var_dump. I want to walk array and add two element inside each array. I want is:</p>
  
  <pre><code> $checkin = "2014-2-4"  //i will be changed according to textbox value.
  
   array (size=2)
   0 =&gt; 
   array (size=8)
    'id' =&gt; string '66' (length=2)
    'room_name' =&gt; string 'Luxury' (length=6)
    'no_of_room' =&gt; string '0' (length=1)
    'price' =&gt; string '1000' (length=4)
    'description' =&gt; string 'dfh dvsrtruub  dsgd' (length=19)
    'image' =&gt; string 'arrow.jpg' (length=9)
    'hotel_id' =&gt; string '1' (length=1)
    'check_in_date' =&gt; null
    1 =&gt; 
    array (size=8)
    'id' =&gt; string '65' (length=2)
    'room_name' =&gt; string 'Deluxe' (length=6)
    'no_of_room' =&gt; string '2' (length=1)
    'price' =&gt; string '800' (length=3)
    'description' =&gt; string 'rybsvssfd' (length=9)
    'image' =&gt; string '2P2Z4.png' (length=9)
    'hotel_id' =&gt; string '1' (length=1)
    'check_in_date' =&gt; null
  
   array_walk($jsonArray, create_function('&amp;$subarray', '$subarray[check_in_date] =$check_in;'));
  </code></pre>
  
  <p>In above array_walk function when i use $check_in, it gives me null but not the value. Why is there something wrong or array_walk i not used for my purpose. Please help me. Thanks in advance.</p>