php - displaying names in an array -


using array_chunk have split array of names groups of 4 names, want take 1 of these groups , display in 4 divs, divs named after 1 of member group names, example group->jhon, mark, giovanni, clara divs <div id="jhon></div> <div id="mark"></div> , on.. want display other names in div not equal divs name

you're creating divs @ same point you're outputting names? maybe help:

$garray = array("jhon","mark","josh","buckwheat"); dogroupdiv("jhon",$garray);  function dogroupdiv($group, $grouparray) {    echo '<div id="' . $group . '">';   foreach ($grouparray $name) {      if ($name != $group) echo $name . "<br>";   }   echo '</div>';  } 

should yield: <div id="jhon">mark<br>josh<br>buckwheat<br></div>


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -