All pastes #152898 Raw Edit

pilgrim

public php v1 · immutable
#152898 ·published 2006-08-29 07:38 UTC
rendered paste body
<?phprequire_once 'includes/Uri.php';$route = array(    'inputUri'      => '/(%path%(.%lang%(.%format%)))',    'outputUri'     => '/(%path%.%lang%.%format%',    'vars'          => array(        'path'      => array('([a-z\-]+(?:\/[a-z\-]+)*)', 'index'),        'lang'      => array('(fr|en)', 'fr'),        'format'    => array('(html)', 'html'),    ));echo '<xmp>$route = ';print_r($route);echo '</xmp>';//exit;$uri = new Uri($route);$myUri = '/index.en.html';echo '<xmp>$myUri = ';print_r($myUri);echo '</xmp>';if ( !$data = $uri->parse($myUri) ) {    die('Format incorrect !');}echo '<xmp>$data = ';print_r($data);echo '</xmp>';$newUri = $uri->build($data);echo '<xmp>$newUri = ';print_r($newUri);echo '</xmp>';?>