Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:56:22+00:00 2026-06-07T09:56:22+00:00

The following array is stored in $this->config->item(‘userlib_profile_fields’) Array ( [0] => Array ( [first_name]

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:56:23+00:00Added an answer on June 7, 2026 at 9:56 am

    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
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following serialized PHP array stored in a mySQL database: a:2:{i:2070;s:4:0.00;i:1901;s:4:1.00;} Now,
The array in the database is stored as a serialized string, such as this:
I have the following array: [0] => Array ( [name] => The Name [description]
I am trying to store a string into an integer array with the following
// given following array: $data = array( 0=>array( data=>object1, col=>array( 0=>array( data=>object2, col=>array( 0=>array(
Given following array: var arr = [undefined, undefined, 2, 5, undefined, undefined]; I'd like
I have the following array: $franchise_a_status[] = array( 'id' => $franchise['franchise_id'], 'text' => $franchise['franchise_surname'].
I have the following array(in python): arr= ['\n', ' a#B\n', ' c#D\n'] Now I
I have taken following array; to fill-up gallery: private Integer[] mImageIds = { R.drawable.one,
Given the following array: $array = array( 'note' => array('test', 'test1', 'test2', 'test3', 'test4'),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.