array question
| From: | Richard Kurth | Date: | Mon, 24 Feb 2003 20:23:21 +0000 |
| Subject: | array question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-136973@lists.php.net to get a copy of this message | ||
This is the code I am using to get the data out of the text file
below. Now I need to turn the $group[3] into an array of its own so
that I can make changes to it. How do I turn this into an array that
I can reference with $group[0]. What I need to be able to do is
search for the label in $group[0] and then make changes to the stuff
in $group[3] like delete add or change.
<?
$groups= file("group");
$number_in_group = count($groups);
?>
<table border="1">
<?
for ($i=0; $i<$number_in_group; $i++){
$group=explode(":",$groups[$i]);
?>
<tr>
<td><? echo$group[0]?></td>
<td><? echo$group[3]?></td>
</tr>
<?}?>
</table>
The DATA
site1:x:503:tester1
site2:x:504:tester2,tester2a
site3:x:505:tester3,tester3a,tester3b
site4:x:506:tester4
site5:x:507:tester5,tester5a,tester5b
site6:x:508:tester6
site7:x:509:tester7,tester7a,tester7b
--
Best regards,
Richard mailto:rdkurth@starband.net