tags:

views:

21

answers:

1

Hi,

I have three arrays:

$arr_student_name = array('bharani','vasanth','kumar');
$arr_student_dept = array('CSE','ECE','EEE');
$arr_student_year = array('2','3','4');

I want output something like this,

Name        Dept Year
Bharani     CSE   2
vasanth     ECE   3
kumar       EEE   4

How to build the output somthing like above?

Each column is a separate array but I want output something like above.

Advise

+3  A: 
$arr_student_name = array('bharani', 'vasanth', 'kumar');
$arr_student_dept = array('CSE', 'ECE', 'EEE');
$arr_student_year = array('2', '3', '4');
$str = '<table>';
$str .= '<tr><td>Name</td><td>Dept</td><td>Year</td></tr>';
for ($i = 0; $i <= count($arr_student_name); $i++) {
    $str .= '<tr><td>'.$arr_student_name[$i].'</td><td>'.$arr_student_dept[$i].'</td><td>'.$arr_student_year[$i].'</td></tr>';
}
$str .= '</table>';
echo $str;
kgb
yes man ..i forgot this method...
Bharanikumar