Home >Backend Development >PHP Tutorial >python - php数组前面部分拿到后面

python - php数组前面部分拿到后面

WBOY
WBOYOriginal
2016-06-06 20:27:101225browse

python 的写法,loc4是一个很长的序列几十万吧,把前面11个拿到后面去

loc6 = loc4[len(loc4)-11:]+loc4[:len(loc4)-11]

php

改成php代码,数组合并,键值还是从0开始顺序,步进1

回复内容:

python 的写法,loc4是一个很长的序列几十万吧,把前面11个拿到后面去

loc6 = loc4[len(loc4)-11:]+loc4[:len(loc4)-11]

php

改成php代码,数组合并,键值还是从0开始顺序,步进1

<code>$loc6 = array_merge(array_slice($loc4, 11), array_slice($loc4, 0, 11));</code>

PS:Python代码是不是写错了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn