如何在3分49秒后重定向到另一个页面

I was working on a site which plays songs using soundcloud API; what I thought is why not create a loop so that songs keep playing without bothering the user, to select different song after every song. For this what I am doing is redirect the user to page of another song once the current song completes. Soundcloud API provide me the duration of currently playing song in a PHP variable I am using that variable in http-redirect but the problem is what happens when a song with duration 3minutes and 49 seconds is playing how to convert that into seconds. Because http-redirect works on seconds and not on minutes. If I use 3.49 * 60 that will make it 209.4 but actually 3 minutes and 49 seconds have 229 seconds.

What about this:

<?php
// $length is the length of the song
$length_array = explode('.', $length);
$seconds = $length_array[0] * 60 + $length_array[1];
// ... redirect after $seconds ...

That cuts the string into 2 pieces, the first one is the amount of minutes (that are multiplied by 60 to get the amout of seconds) and the second one is the amount of seconds.

See explode to learn more.

Hope this helps.