Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm sure there are "PHP-XML Parsers" but I don't know any to vouch for. You can write your own (not that hard just tedious) using PHP's <a href="http://www.php.net/manual/en/function.xml-parse.php" rel="nofollow">xml_parse</a></p> <p>Create an array that's comfortable for you to work with, such as</p> <pre><code>$bus[year][month][day][hour][minute] = true; </code></pre> <p>Looping through that, will give you what you want.</p> <p>Good Luck!</p> <hr> <p>As per your comments, if you have an array:</p> <pre><code>$bus[0] = 364; // 6:04 am $bus[1] = 404; // 6:44 am </code></pre> <p>Then you can find the closest value by looping through. Keep track of the index, and display 5 indecies prior to that.</p> <hr> <p>Here's quick, dirty, unoptimized, don't use this example:</p> <pre><code>&lt;?php error_reporting(0); $friday = array(300,400,500,600,700,800,900,1000); $saturday = array(320,420,520,620,720,820,920,1020); $schedule = array(0 =&gt; $M, $T, $W, $T, $friday, $saturday, $S); $dayNumber = 4; $time = 720; // noon $shown = 0; foreach ($schedule[$dayNumber] as $hm) { if ($hm &gt; $time) { $hour = floor($hm / 60); $minute = $hm - ($hour*60); echo "$hour:$minute, "; $shown++; } if ($shown == 5) break; } if ($shown &lt; 5) { $time = 0; echo 'Or tomorrow: '; foreach ($schedule[$dayNumber + 1] as $hm) { if ($hm &gt; $time) { $hour = floor($hm / 60); $minute = $hm - ($hour*60); echo "$hour:$minute, "; $shown++; } if ($shown == 5) break; } } ?&gt; </code></pre> <p>output:</p> <pre><code>13:20, 15:0, 16:40, Or tomorrow: 5:20, 7:0, </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload