Home > Net >  PHP: How to access an array key and insert a value
PHP: How to access an array key and insert a value

Time:10-07

Good day everyone!

I would like to ask some help regarding accessing an array key and inserting a value in array key.

So I have multiple arrays and all I want is to access sign_in_logs array and insert a new key value pair time_id.

So my question is how do I access array key and inserting some value in it.

My Array

Array
(
  [data] => Array
  (
     [sign_in_logs] => Array
     (
       [0] => Array
       (
         [object_id] => 'some id'
       )
     )
  )
)

Expected Array

Array
(
  [data] => Array
  (
     [sign_in_logs] => Array
     (
       [0] => Array
       (
         [object_id] => 'some id'
         [time_id] => 'some id'
       )
     )
  )
)

Thank you so much

  • Related