Jump to content

arrays and loops


AleksBg

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/48753-arrays-and-loops/
Share on other sites

that should suffice i would think  :D

 

$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>';

Link to comment
https://forums.phpfreaks.com/topic/48753-arrays-and-loops/#findComment-238932
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.