How to add an element to array?

前端 未结 3 1426
北荒
北荒 2021-01-26 00:32

How to add element to exist array? I have array:

Array ( [0] => Array ( [user_id] => 1 [user_login] => Saibamen [user_password] => 4028a0e356acc947fc         


        
3条回答
  •  时光取名叫无心
    2021-01-26 01:20

    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']);
    

    is what you want I guess

提交回复
热议问题