Hi,
I'm trying to create a function which gives the total of time. Now the
problem is that the function resets the int. $hour. How can I get them to be
saved... I tried global $hour etc... but it didn't help and I couldn't find
it.
How can I get these vars to be valid through out the whole script..
Thanks in advance, Maarten
$hour = 0;
$minute = 0;
$second = 0;
function total_time ($track_id)
{
$hour = substr ( $track_id, -6, -4 ) + $hour;
$minute = substr ( $track_id, -4, -2 ) + $minute;
$second = substr ( $track_id, -2 ) + $second;
echo "$hour:$minute: $second <br />";
}
I'm trying to create a function which gives the total of time. Now the
problem is that the function resets the int. $hour. How can I get them to be
saved... I tried global $hour etc... but it didn't help and I couldn't find
it.
How can I get these vars to be valid through out the whole script..
Thanks in advance, Maarten
$hour = 0;
$minute = 0;
$second = 0;
function total_time ($track_id)
{
$hour = substr ( $track_id, -6, -4 ) + $hour;
$minute = substr ( $track_id, -4, -2 ) + $minute;
$second = substr ( $track_id, -2 ) + $second;
echo "$hour:$minute: $second <br />";
}
Comment