using array_chunk I have split an array of names to groups of 4 names, I want to take one of these groups and display it in 4 divs, divs are named after one of the member group names, example group->jhon, mark, giovanni, clara  then  divs are <div id="jhon></div>
<div id="mark"></div> and so on..
I want to display only the other names in the div that is not equal to the divs name 
views:
44answers:
3
                
                A: 
                
                
              
            You're creating the DIVs at the same point you're outputting the names? Maybe something like this would help:
$garray = array("Jhon","Mark","Josh","Buckwheat");
doGroupDiv("Jhon",$garray);
function doGroupDiv($group, $grouparray) {
  echo '<div id="' . $group . '">';
  foreach ($grouparray as $name) {
     if ($name != $group) echo $name . "<BR>";
  }
  echo '</div>';
}
Should yield:  <div id="Jhon">Mark<BR>Josh<BR>Buckwheat<BR></div>
                  Fosco
                   2010-10-08 17:48:36
                
              
                
                A: 
                
                
              
            It sounds like you're looking for something like this:
<?php
$namesList = array(
    "Mark",
    "John",
    "Giovanni",
    "Clara"
);
foreach ($namesList as $name) {
    echo "<div id='" . strtolower($name) . "'>\n";
    echo "\t<ul>\n";
    foreach ($namesList as $innerName) {
        if ($innerName != $name) {
            echo "\t\t<li>" . $innerName . "</li>\n";
        }
    }
    echo "\t</ul>\n";
    echo "</div>\n";
}
?>
Which would yield this:
<div id='mark'>
    <ul>
        <li>John</li>
        <li>Giovanni</li>
        <li>Clara</li>
    </ul>
</div>
<div id='john'>
    <ul>
        <li>Mark</li>
        <li>Giovanni</li>
        <li>Clara</li>
    </ul>
</div>
<div id='giovanni'>
    <ul>
        <li>Mark</li>
        <li>John</li>
        <li>Clara</li>
    </ul>
</div>
<div id='clara'>
    <ul>
        <li>Mark</li>
        <li>John</li>
        <li>Giovanni</li>
    </ul>
</div>
                  Chris Forrette
                   2010-10-08 17:55:58
                
              
                
                A: 
                
                
              
            I cant tell you exactly what the code is because I have never used array chunks, but it would be something like the following:
foreach($array as $name) {
    echo "<div id='$name'><ul>";
    foreach($array as $name2) {
        if($name2 != $name) {
            echo "<li>".$name2."</li>;
        }
    }
    echo "</ul></div>";
}
Hope this is the answer you were looking for.
                  ClarkeyBoy
                   2010-10-08 17:56:13