Location: PHPKode > projects > Artise > artise/environment/uri/slicer.class.php
<?php
namespace Env\Uri { final class Slicer { private $string; public function slice($position, $delimiter = "/") { $string = $this->string; if(substr($string, 0, 1) == substr($string, -1) && substr($string, 0, 1) == $delimiter) $string = substr($string, 1, -1); $array = explode($delimiter, $string); if(is_array($array)) { if(isset($array[$position])) return new Slicer($array[$position]); } return null; } public function __construct($string) { $this->string = $string; } public function __toString() { return $this->string; } } }
Return current item: Artise