How to extract the keys and values of an array without index [closed]

只愿长相守 提交于 2019-12-01 03:29:47
$array1 = array_keys($array);
$array2 = array_values($array);

well, you can read here.

In computer science, an array data structure or simply an array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula.

$keys = array_keys($array);
$values = array_values($array);

Note however that array(0=>'item') and array('item') are exactly identical as far as PHP is concerned. There is no such thing as a php array item without an index. If you do not supply an index PHP will silently add a numeric index.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!