ID:               12528
 Comment by:       b-fulltime1397 at hotmail dot com
 Reported By:      jinn at magiclamp dot f2s dot com
 Status:           Bogus
 Bug Type:         Arrays related
 Operating System: linux
 PHP Version:      4.0.6
 New Comment:

<a href=http://bfulltimeteensavi-c.da.ru>fulltime b</a>


Previous Comments:
------------------------------------------------------------------------

[2001-09-14 19:42:22] [EMAIL PROTECTED]

Err: Array_unique/array_diff/array_intersect isn't supposed to handle
multi-dimension _arrays_, nor objects.

See also 10658


------------------------------------------------------------------------

[2001-09-14 19:39:31] [EMAIL PROTECTED]

Array_unique isn't supposed to handle multi-dimension strings, nor
objects.

See also 10658



------------------------------------------------------------------------

[2001-08-02 05:39:03] jinn at magiclamp dot f2s dot com

My ISP recently upgraded from 4.0.3pl1 to 4.0.6 - i have a script that
runs an 'array_unique' on a 2d array.  This used to work previously,
but now it reduces the array down to a single item.

Here is the section of script:
// CLEAN UP DUPLICATES THAT DON'T HAVE THE DESCRIPTION, BUT ARE THE
SAME SECTION
                                if ( $debug ) echo "<P 
style='text-align:left'><B>CLEAN UP
DUPLICATE SECTIONS</B><BR>
                                                                                       
                         <I>[\$idx,\$count]...</I><BR>";
                                $count = 0;
                                for ( $idx = 0; $idx < count($section_result); ++$idx 
) {
                                        $comp1 = strtolower($section_result[$idx][0]);
                                        $comp2 = 
strtolower($section_result[$idx+1][0]);
                                        $comp3 = 
strtolower($section_result[$idx-1][0]);

                                        if ( $comp1 == $comp2 ) {
                                        // IF THIS ENTRY IS THE SAME SECTION AS THE 
NEXT ONE
                                                if ( $section_result[$idx+1][1] != '' 
) {
                                                        $section[$count][0] = 
$section_result[$idx+1][0];
                                                        $section[$count][1] = 
$section_result[$idx+1][1];
                                                        ++$count;
                                                } elseif ( $section_result[$idx][1] != 
'' ) {
                                                        $section[$count][0] = 
$section_result[$idx][0];
                                                        $section[$count][1] = 
$section_result[$idx][1];
                                                        ++$count;
                                                }
                                        } elseif ( $comp1 != $comp3 ) {
                                                $section[$count][0] = 
$section_result[$idx][0];
                                                $section[$count][1] = 
$section_result[$idx][1];
                                                ++$count;
                                        }
                                        if ( $debug ) echo "[$idx,$count] " . 
$section[$count-1][0] . " --
" . $section[$count-1][1] . "<BR>";
                                } // close for

                                if ( $debug ) echo "</P>";

                                $section = array_unique($section);

                                if ( $debug ) {
                                        echo "<P style='text-align:left'><B>UNIQUE 
SECTIONS AFTER
CLEAN-UP</B><BR>";
                                        echo "section count: " . count($section) . " | 
$count<BR>";
                                        echo "<I>Work it thru a 'for' loop:</I><BR>";
                                        for ( $idx = 0; $idx < $count; ++$idx ) {
                                                echo $section[$idx][0] . " -- " . 
$section[$idx][1] . "<BR>";
                                        }
                                        echo "<I>Work it thru a 'foreach' 
loop:</I><BR>";
                                        foreach ( $section as $message ) {
                                                echo $message[0] . " -- " . 
$message[1] . "<BR>";
                                        }
                                        echo "</P>";
                                        echo "<P style='text-align:left'><B>UNIQUE 
SECTION_RESULT AFTER
CLEAN-UP</B><BR>";
                                        foreach ( $section_result as $message ) {
                                                echo $message[0] . " -- " . 
$message[1] . "<BR>";
                                        }
                                        echo "</P>";
                                }

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=12528&edit=1

Reply via email to