This repository has been archived on 2025-07-13. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
open-heraklion-bus/libdata.php

38 lines
700 B
PHP
Raw Normal View History

2015-07-15 16:41:33 +03:00
<?php
include 'data.php';
function getStopsOfRoute($id){
global $routes;
foreach ($routes as $route){
if ($route['id'] == $id){
return $route['stops'];
}
}
}
function getRoutesOfLine($line){
global $routes;
$tmp = array();
foreach ($routes as $route){
if ($route['line'] == $line){
array_push($tmp, $route);
}
}
return $tmp;
}
function getRoutesByStop($stopId){
global $routes;
$tmp = array();
foreach ($routes as $route){
foreach ($route['stops'] as $stop){
if ($stop == $stopId){
array_push($tmp, $route);
}
}
}
return $tmp;
}
?>