array ('id' => 3, 'username' => 'alex ','parentname'=> 'john'
,'proname' => 'tttt' 'num'=> 1 , 'userid' =>6 ,'parentid'=>8 ,
'cpid'=> 0 ,'mobile'=> 15533336666 ,'parentmobile' => 156477765465) ;
把最后两个分别放在第2个和第4个位置 ,怎么重新排序?
array ('id' => 3, 'username' => 'alex ','mobile'=> 15533336666
,'parentname'=> 'john' ,'parentmobile' => 156477765465 ,'proname' => 'tttt' 'num'=> 1 ,
'userid' =>6 ,'parentid'=>8 ,'cpid'=> 0 );
PbootCMS是一款高效、简洁、强悍的开源PHP企业网站开发建设管理系统。 PbootCMS 1.1.8 更新日志:2018-08-07 1.修复提交表单多选字段接收数据问题; 2.修复登录过程中二次登陆在页面不刷新时验证失败问题; 3.新增搜索结果fuzzy参数来控制是否模糊匹配; 4.新增父分类,顶级分类名称及链接独立标签,具体见手册; 5.新增内容多图拖动排序功能。
243
$a = Array( 'id' => 3, 'username' => 'alex ', 'parentname'=> 'john', 'proname' => 'tttt', 'num'=> 1 , 'userid' =>6 , 'parentid'=>8 , 'cpid'=> 0 , 'mobile'=> 15533336666 , 'parentmobile' => 156477765465);$k = array ( 'id', 'username', 'mobile', 'parentname', 'parentmobile', 'proname', 'num', 'userid', 'parentid', 'cpid', 'mobile',);extract($a);$b = compact($k);var_export($b);
array ( 'id' => 3, 'username' => 'alex ', 'mobile' => 15533336666, 'parentname' => 'john', 'parentmobile' => 156477765465, 'proname' => 'tttt', 'num' => 1, 'userid' => 6, 'parentid' => 8, 'cpid' => 0,)
多谢了,能否不用extract和compact ,只用foreach能实现吗?谢谢了
如果没有样本,就不可能完成
如果有样本,还拘泥于形式,有什么意义吗?
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号