How output duplicate elements in multi dimensional array ???

Hello Everyone, I been teaching myself PHP off and on for nearly five months after work .. that’s what makes the easy PHP hard to learn. Anyway, I been working with this code for days and nothing I tried will output duplicates to screen. Somewhere during the process I got hook on doing it with a *loop*. I found tons of working code while googling but not one of them worked for multi dimensional array and the tutorials don’t seem to go into details like it does for everything else PHP. Maybe I just plain slow. Anyway, I hope someone can help me solve this problem. If not, you guys and gals are stuck with me anyway :) because my PHP forum quest is over and I know for a fact that Google can’t find/list everything.

Thanks in advance for any help.

btw: The default code font being used is blinding.

Code:

<html><head><title></title></head>
<body>

<?php

$_ARRAY=array(array("Joye",1111,"Cake"),        //  MULTIDIMENSIONAL ARRAY:
              array("Earl",7777,"Rake"),
              array("Joye",2222,"Pear"),
              array("Ruth",7777,"Rose"),
              array("Joye",3333,"Cake"),
              array("Wong",7777,"Cake"),  );
?>

<pre>
<?php

echo "Printing All Elements with a Loop::";

echo "<ol>";
    for ($row = 0; $row < 6; $row++) {                            #  6 row
          echo "<li><b>        r-$row</b>";                    #  header
          echo "<ul>";

            for ($col = 0; $col < 3; $col++) {                    #  3 col
                  echo "<li>".$_ARRAY[$row][$col]."</li>"; }    #  print list
    echo "</ul>";
    echo "</li>";
}
echo "</ol>";
## ....................................................
## ....................................................
## ....................................................
echo "Printing All Duplicates using a Loop ... No luck:: :( ";
    echo "\n";
    echo "\n";
echo("Testing:; Manually printing a dupicate number (row1-col2){$_ARRAY[1][2]}");
    echo "\n";

?>
</pre>
</body>
</html>


View full post on Tycoon Talk

, , , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved