将项目推送到 PHP 中的关联数组 [英] Push item to associative array in PHP
本文介绍了将项目推送到 PHP 中的关联数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试将项目推送到这样的关联数组:
I've been trying to push an item to an associative array like this:
$new_input['name'] = array(
'type' => 'text',
'label' => 'First name',
'show' => true,
'required' => true
);
array_push($options['inputs'], $new_input);
然而,不是 'name' 作为键添加了一个数字.还有其他方法吗?
However, instead of 'name' as the key in adds a number. Is there another way to do it?
推荐答案
$options['inputs']['name'] = $new_input['name'];
这篇关于将项目推送到 PHP 中的关联数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文