开发者

How to updated nested array

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜