oops forgot to add the tiein to each()...
punchline: there are several ways to step through an array, all can be made to do the same thing, but some are more useful "as is" in certain situations
<?php
$delete = array();
$delete[222] = array( 'name'=>'ednark', 'value'=>'SYN' );
$delete[223] = array( 'name'=>'Dark_Storm', 'value'=>'ACK' );
$delete[224] = array( 'name'=>'ednark', 'value'=>'1 w1ll h4x0r j00' );
$delete[225] = array( 'name'=>'Dark_Storm', 'value'=>'k' );
echo "<pre>\n<hr />foreach\n\n\n";
foreach ( $delete as $post_id=>$post_info ) {
echo "Deleting this post '{$post_id}'<br />\n";
echo " user : '{$post_info['name']}'<br />\n";
echo " value : '{$post_info['value']}'<br /><br />\n";
}
echo "\n<hr />while each\n\n\n";
reset($delete);
while ( list($post_id,$post_info) = each($delete) ) {
echo "Deleting this post '{$post_id}'<br />\n";
echo " user : '{$post_info['name']}'<br />\n";
echo " value : '{$post_info['value']}'<br /><br />\n";
}
echo "\n<hr />for\n\n\n";
reset($delete);
for ( $i=0; $i<count($delete); $i++ ) {
list($post_id,$post_info) = each($delete);
echo "Deleting this post '{$post_id}'<br />\n";
echo " user : '{$post_info['name']}'<br />\n";
echo " value : '{$post_info['value']}'<br /><br />\n";
}
echo "</pre>";
?>