AleksBg Posted April 26, 2007 Share Posted April 26, 2007 Hi everybody. Since i am a begginer i need help on a simple issue. I am trying to combine arrays in one output. $mail_1 = array('name' , 'last name' , 'city' ); $mail_2 = array($f1,$f2,$f3); The idea is to make output in the table: <table> <tr> <td>name (1st value from $mail_1 array): </td> <td>$f1 </td> </tr> </table> Now, which loop should i use, since i am not very familiar with them... Thanks Quote Link to comment Share on other sites More sharing options...
taith Posted April 26, 2007 Share Posted April 26, 2007 that should suffice i would think $mail_1 = array('name' , 'last name' , 'city' ); $mail_2 = array($f1,$f2,$f3); echo '<table>'; for($i=0; $i<=count($mail_1)-1; $i++){ echo '<tr>'; echo ' <td>'.$mail_1[$i].'</td>'; echo ' <td>'.$mail_2[$i].'</td>'; echo '<tr>'; } echo '</table>'; Quote Link to comment Share on other sites More sharing options...
AleksBg Posted April 26, 2007 Author Share Posted April 26, 2007 works fine, tnx! Quote Link to comment Share on other sites More sharing options...
taith Posted April 26, 2007 Share Posted April 26, 2007 no problemo! Quote Link to comment Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 this more efficient as it doesn't count the array values every loop for($i=0, $k=count($mail_1); $i<$k; $i++){ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.