Q:

How to create an array from key in multi-dimension array in PHP

The following array is stored in $this->config->item('userlib_profile_fields')
Array
(
[0] => Array
    (
        [first_name] => First Name
    )
[1] => Array
    (
        [family_name] => Family name
    )
[2] => Array
    (
        [web_address] => Web Address
    )
[3] => Array
    (
        [company_name] => Company Name
    )
...
...
)

I want to create an array from the above keys.
Array(first_name, family_name, web_address,company_name, .....)

I tried this but it give an errors.
$profile_columns = array();
foreach($this->config->item('userlib_profile_fields') as $value)
{
    foreach($value as $key=>$value)
    {
        //var_dump ($key);
        $profile_columns = array_push($profile_columns,$key);
    }
}
// error: array_push() expects parameter 1 to be array, integer given
array_push() expects parameter 1 to be array, null given

A:

Example array that replicate yours.
$array = array(
    array('first_name' => 'First Name'),
    array('family_name' => 'Family Name'),
    array('web_address' => 'Web Address'),
    array('company_name' => 'Company Name')
);

loop and extract. (preserves array keys)
$items = array();
foreach($array as $item) {
    foreach($item as $key => $value) {
        $items[$key] = $value;
    }
}

this will output
Array
(
    [first_name] => First Name
    [family_name] => Family Name
    [web_address] => Web Address
    [company_name] => Company Name
)

If you want to reset array keys to indexed array use this.
$items = array();
foreach($array as $item) {
    foreach($item as $key => $value) {
        $items[] = $value;
    }
}

this will output
Array
(
    [0] => First Name
    [1] => Family Name
    [2] => Web Address
    [3] => Company Name
)

