Веб-интерфейс к MPD.
[mpd-web.git] / system / helper.php
1 <?php
2
3 function cut_file($str) {
4         $result=array();
5         $result=preg_split("/\//",$str);
6         //print_r($result);
7         return $result[count($result)-1];
8 }
9
10
11 function cut_lastDir($str) {
12         $result=array();
13         $result=preg_split("/\//",$str);
14         //print_r($result);
15         return $result[count($result)-1];
16 }
17
18
19 function cut_firstDir($str) {
20         $result=array();
21         preg_match("/([^\/]+)\//",$str,$result);
22
23         //print_r($result);
24         return $result[1];
25 }
26
27 function cut_upperDir($str) {
28         $result=array();
29         preg_match("/(.*)\/([^\/]*)/",$str,$result);
30
31         //print_r($result);
32         return $result[1];
33 }
34
35 ?>