Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class turi {
- public static function uri_to_assoc($uri = '')
- {
- $query_string = array();
- foreach ($uri as $val)
- {
- $temp = explode(':', $val);
- if (isset($temp[2]))
- {
- $key = $temp[0];
- unset($temp[0]);
- $query_string[$key] = $temp;
- }
- elseif(isset($temp[1]))
- {
- $query_string[$temp[0]] = $temp[1];
- }
- }
- return $query_string;
- }
- public static function assoc_to_uri($assoc = array())
- {
- $temp = array();
- foreach ($assoc as $key => $val)
- {
- $temp[]=$key.':'.implode(':', (array)$val);
- }
- return implode('/', $temp);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement