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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:34:11+00:00 2026-05-29T11:34:11+00:00

I am having a bit of an issue with my PHP array. First thing

  • 0

I am having a bit of an issue with my PHP array. First thing they have arrays inside of this array and I am trying to remove duplicates. I did a print_r of my array and it printed out this….

Array (
   [0] => Array ( [creditfeeid] => 318 [client] => Test 1 [adjustment] => 444.00 [issuedate] => 2012-02-10 20:27:00 [isrecurring] => No [comment] => 444 [commission] => 17.76 )
   [1] => Array ( [creditfeeid] => 319 [client] => Test 1 [adjustment] => 333.00 [issuedate] => 2012-02-10 20:27:00 [isrecurring] => No [comment] => 333 [commission] => 9.99 )
   [2] => Array ( [creditfeeid] => 320 [client] => Test 1 [adjustment] => 111.00 [issuedate] => 2012-02-10 20:27:00 [isrecurring] => No [comment] => 111 [commission] => 1.11 )
   [3] => Array ( [creditfeeid] => 321 [client] => Test 1 [adjustment] => 222.00 [issuedate] => 2012-02-10 00:00:00 [isrecurring] => No [comment] => 111 [commission] => 2.22 )
   [4] => Array ( [creditfeeid] => 292 [client] => Test 1 [adjustment] => 555.00 [issuedate] => 2012-01-25 13:04:43 [isrecurring] => Yes [comment] => 555 [commission] => 5.00 )
   [5] => Array ( [creditfeeid] => 317 [client] => Test 2 [adjustment] => 666.00 [issuedate] => 2012-02-10 00:00:00 [isrecurring] => No [comment] => 666 [commission] => 39.96 )
) 

I am trying to remove the duplicates in the [‘comment’] which are

444
333
111
111
555
666

I have been working with unique_array and that doesn’t seem to do the trick. This is what I have tried….

foreach($array as $row){
if(array_unique($row['comment'])){
    continue;
}else{
    echo $row['comment'] . "<br/>";
}
}

also

$array = array_unique($array);

foreach($array as $row){

        echo $row['comment'] . "<br/>";
}

What am I doing wrong? Is array_unique not the answer to my problem?

Thanks in advance,

J

  • 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-05-29T11:34:11+00:00Added an answer on May 29, 2026 at 11:34 am

    array_unique is not the answer to your problem. Instead, consider something like this:

    $new_array = Array();
    foreach($old_array as $a) {
        if( !isset($new_array[$a['comment']]))
            $new_array[$a['comment']] = $a;
    }
    $new_array = array_values($new_array);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a strange issue here, i have this bit of code: <?php if
hello fellow java developers. I'm having a bit of an issue here. I have
I'm having a bit of an issue by using Conditional Statements in PHP separated
Coming from Win32, I am having bit of an issue or a problem trying
I'm having a bit of an issue with PHP emailing from a HTML form.
Having a bit of an issue accessing dynamically added DIV's immediately after they've been
I'm having a bit of issue with events in prototype. I'm trying to bind
Im having a bit of an issue where i create an array of button
In PHP 5.2.x, mySQL 5.x Im having a bit of an issue wrapping my
Ok. I'm having an issue with the following bit of code: StreamReader arrComputer =

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.