如何添加元素到数组? [英] How to add an element to array?
本文介绍了如何添加元素到数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在存在数组中添加元素?我有数组:
How to add element to exist array? I have array:
Array ( [0] => Array ( [user_id] => 1 [user_login] => Saibamen [user_password] => 4028a0e356acc947fcd2bfshfh3w26gdshhbf00cef11e128d484a [user_email] => teeeest@test.pl [user_active] => 1 [user_last_login_ip] => 127.0.0.1 [user_perms] => ) )
我想在此数组中添加头像"参数:
I want add 'avatar' parametr to this array:
$avatar = md5($array_in_this_question[0]['user_email'])
推荐答案
好吧,您需要将数组分配给变量作为开始,所以:
Well you'd need to assign the array to a variable for a start, so:
$theArray = Array ( [0] => Array ( [user_id] => 1 [user_login] => Saibamen [user_password] => 4028a0e356acc947fcd2bfshfh3w26gdshhbf00cef11e128d484a [user_email] => teeeest@test.pl [user_active] => 1 [user_last_login_ip] => 127.0.0.1 [user_perms] => ) );
$theArray[0]['avatar'] = md5($array_in_this_question[0]['user_email']);
我想是你想要的
这篇关于如何添加元素到数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文