Re: [PHP] Removeing duplicates inside for/foreach loop.

This is a discussion on Re: [PHP] Removeing duplicates inside for/foreach loop. within the PHP General forums, part of the PHP Programming Forums category; On Tue, Jul 15, 2008 at 12:50 PM, Niccolo Machiavelli <php.coder@tx.rr.com> wrote: > $...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-15-2008
Eric Butera
 
Posts: n/a
Default Re: [PHP] Removeing duplicates inside for/foreach loop.

On Tue, Jul 15, 2008 at 12:50 PM, Niccolo Machiavelli
<php.coder@tx.rr.com> wrote:
> $array = array(
>
> 1 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name"
> => "Mike", "order_payment_last_name" => "Smith"),
>
> 2 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name"
> => "Mike", "order_payment_last_name" => "Smith"),
>
> 3 => array("order_number" => "45Y3453245T23T5", "order_payment_first_name"
> => "Steve", "order_payment_last_name" => "Jobs"),
>
> 4 => array("order_number" => "34RTB345T45T456", "order_payment_first_name"
> => "Frank", "order_payment_last_name" => "Capra"),
>
> 5 => array("order_number" => "567U457645645Y6", "order_payment_first_name"
> => "John", "order_payment_last_name" => "Doe"),
>
> 6 => array("order_number" => "7698234T456M963", "order_payment_first_name"
> => "Bill", "order_payment_last_name" => "Williams"));
>
>
>
> echo('<pre>');
>
> print_r($array);
>
> echo('</pre>');
>
>
>
> My question is I want to remove duplicate order numbers in other words ditch
> *one* of the Mike Smith rows there's a duplicate order number there.
>
> And I need to do it in either a for/foreach loop. Somehow there's got to be
> a simple way to check and only output non duplicate order numbers while I'm
> looping thru the data. Any help would be greatly appreciated.
>
>
>
>
>
> Thanks
>
> php.code@tx.rr.com
>
>


Would it be possible to leave them out in your original query?
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:00 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0