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

arrays, extract, php

Solution

$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.

Problem

I want to extract data from an array (original array with key and value). After I extract the array, I want two new arrays, the first one with just the keys, the second one with just the values, and both without indexes (see code example). ``` // original array $array = array( "name1"=>500 ,"name2"=>400 ,"name3"=>300 ,"name4"=>200 ,"name5"=>100 ); // after extraction $array1 = array('name1','name2','name3','name4','name5'); $array2 = array(500,400,300,200,100); // not like this // $array1 = array(0=>'name1',1=>'name2',2=>'name3',3=>'name4',4=>'name5); // $array2 = array(0=>500,1=>400,2=?300,3=>200,4=>100); ```

Original source