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 8492937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:52:06+00:00 2026-06-10T22:52:06+00:00

The 3D assoc. array looks like below. Array ( [COL] => Array ( [0]

  • 0

The 3D assoc. array looks like below.

Array 
( 
    [COL] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 775.00 
                            [name] => COL 
                        ) 
                    [1] => Array 
                        ( 
                            [emp_num] => 26 
                            [user_name] => John Doe 
                            [amount] => 555.00 
                            [name] => COL 
                        ) 
                ) 
    [RA. 20%] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 110.00 
                            [name] => RA. 20% 
                        ) 
                ) 
    [BS] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 444.00 
                            [name] => BS 
                        ) 
                ) 
)  

I want to remove the the last key=>value pair of each inner most array. (want to remove the key value pair that has [name] for the key)
The result should look like the array below.

Array 
( 
    [COL] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 775.00
                        ) 
                    [1] => Array 
                        ( 
                            [emp_num] => 26 
                            [user_name] => John Doe 
                            [amount] => 555.00
                        ) 
                ) 
    [RA. 20%] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 110.00
                        ) 
                ) 
    [BS] => Array 
                ( 
                    [0] => Array 
                        ( 
                            [emp_num] => 1000001 
                            [user_name] => Test User 
                            [amount] => 444.00
                        ) 
                ) 
)   

I wrote a function to do this.

<!-- language: php -->    
function remove_name_from_psa($psa_array){

            foreach( $psa_array as $key=>$value ) {
                foreach( $value as $key2=>$value2 ){
                    foreach( $value2 as $key3=>$value3 ){                    
                         if( $key3 != 'name') {
                            $psa_name_removed[$key][$value[$key2][$value2[$key3]]] = $value3;
                        }
                    }
                }
            }
            return $psa_name_removed;
        }  

The returned array is this, which is obviously not what I need.

Array ( [COST OF LIVING] => Array 
                   ( [] => 555.00 ) 
        [RENT ALLOW. 20%] => Array 
                   ( [] => 110.00 ) 
        [BASIC SALARY] => Array 
                   ( [] => 444.00 ) 
      )  

And there are lots of undefined offset and undefined index notices.
$psa_name_removed[$key][$value[$key2][$value2[$key3]]] = $value3; //is this the line I am doing the mistake? Or is the whole method a mistake? 😛
How can I get this to work? Can anyone help?
Thank You!

  • 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-10T22:52:07+00:00Added an answer on June 10, 2026 at 10:52 pm
    function remove_name_from_psa($psa_array){
    
        foreach( $psa_array as $key => $value ) {
            foreach( $value as $key2 => $value2 ){
                unset( $psa_array[$key][$key2]['name'] );
            }
        }
        return $psa_array;
    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array that looks just like that: array(3) { [fk_article_id]=> string(1) 4
I have part of the code below: while($array = $result->fetch_assoc() ){ $second_query = INSERT
I have a table that looks like this: (so you can picture it visually)
I have a piece of code that looks like this: $result = mysql_query($queryc) or
All, I have some PHP PDO code that looks like this: <?php ... $query=$dbh->prepare(SELECT
Let`s suppose we have a simple (non-assoc) array with 100001 values and these values
My code looks like this: // Connect to SQLite DB DB('/path/to/sqlite.db'); DB('BEGIN TRANSACTION;'); //
HTML: Html of the two forms, looks like: when either buyer or merchant is
$STH_1 = $DBH_R->query(SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'v_c_ei\_9%' ); $stmts_1 = array();
I'm trying to get a specific value from a mysql_fletch_assoc array. I explain. Here

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.