开发者

How to updated nested array

开发者 https://www.devze.com 2023-03-25 21:26 出处:网络
How I can modify nested array e.g. `array ( \'_id\' => new MongoId(\"4e3a81376155a9d439000000\"), \'name\' => \'Umar\',

How I can modify nested array e.g.

`array (
  '_id' => new MongoId("4e3a81376155a9d439000000"),
  'name' => 'Umar',
  'password' => 'rose',
  'email' => 'umar@ibm.com',
  'experience' => 
  array (
    0 => 
    array (
      'company' =&开发者_高级运维gt; 'ibm',
      'from' => '2005',
      'to' => '2007',
    ),
    1 => 
    array (
      'company' => 'sun',
      'from' => '2007',
      'to' => '2009',
    ),
    2 => 
    array (
      'company' => 'oracle',
      'from' => '2009',
      'to' => 'still',
    ),
  ),
)
`

Now i want to update company sun from value existing value is 2007 I want to change with 2006. I am using PHP.

Would you please help.

Best Regards,

Umar


Quite simply:

$yourArray["experience"][1]["from"] = 2006;

0

精彩评论

暂无评论...
验证码 换一张
取 消