我有两个数组从两个sql查询生成$array_1和$array_2.两者都包含[0]索引.我想用索引[0],[1]等加入它们……所以任何人都可以帮助我如何连接php中的两个数组
解决方法:
array_merge — Merge one or more arrays
描述
array array_merge ( array $array1 [, array $... ] )
Merges the elements of one or more arrays together so that the values
of one are appended to the end of the previous one. It returns the
resulting array.If the input arrays have the same string keys, then the later value
for that key will overwrite the previous one. If, however, the arrays
contain numeric keys, the later value will not overwrite the original
value, but will be appended.Values in the input array with numeric keys will be renumbered with
incrementing keys starting from zero in the result array.
压缩阵列:
如果希望[0]为array1 [0]和[1]为array2 [0]等,则可以压缩数组;
Is there a php function like python’s zip?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。