|
Posted by Georg Ringer on 06/17/05 16:34
Hi,
I've got a multidimensional array which looks like this:
$data[] = array('nname' => 'Auerbach', 'vname' => 'Berthold', 'uid' => 20);
$data[] = array('nname' => 'Bloch', 'vname' => 'Ernst', 'uid' => 24);
$data[] = array('nname' => 'Shaw', 'vname' => 'George Bernard', 'uid' =>19);
$data[] = array('nname' => 'Wilde', 'vname' => 'Oscar', 'uid' => 12);
$data[] = array('nname' => 'Wilder', 'vname' => 'Thornton', 'uid' => 38);
........
And I've got the following code, which splitts the last names (nname) =>
$az = array ('ABC','DEF','GHI','JKL','MNO','PQR','STU','VWX','YZ');
$x = 0;
foreach($data as $name) {
if(substr($name[nname], 0,1) == substr($az[$x], 0,1) ||
substr($name[nname], 0,1) == substr($az[$x], 1,2) || substr($name[nname],
0,1) == substr($az[$x], 2,3)) {
if($az[$x] != $alt) {
echo "<br /><big><b>".$az[$x]."</b></big><br />";
$alt = $az[$x];
$x = $x + 1;
}
}
echo $name[nname].', '.$name[vname]."<br />";
}
You can see the problem here:
http://inside.eventshooters.com/typo3conf/ext/rg_zitate/pi1/test.php
Kant, Immanuel => GHI
Waggerl, Karl Heinrich => STU
Wilde, Oscar => STU
Wilder, Thornton => STU
Where is my problem?
Please help me!
Many thanks!
georg
[Back to original message]
|