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
Example array that replicate yours.
loop and extract. (preserves array keys)
this will output
If you want to reset array keys to indexed array use this.
this will output