When I think about the functional of array and I tried to create an array and store in the function acts as the clock but how can I get the array values outside the function?
function theClock($a,$b,$c){
$time['Hour'] = $a;
$time['Minute'] = $b;
$time['Seconds'] = $c;
return $time;
}
//How can I call the array values in there that $time is stored?
I am a beginner of PHP and I want to improve my concept, I am very grateful if anyone can helps, Cheers!
Sorry, I forgot to mention that I would like to use foreach() to shows the array values as the table form.
$show1 = '<table border ="1" >';
foreach($time as $ck => $tk){
$show1 .= '<tr><td>' . $ck . '</td><td>' . $tk . '</td></tr>';
}
$show1 .= '</table>';
$show2 = '<table border ="1">';
foreach($time as $tk){
$show2 .= '<td>' . $tk . '</td>';
$show2 .= '<td>:</td>';
}
$show2 .= '</table>';
echo $show1;
echo $show2;
theClock(11,12,13);