Source for file path.php
Documentation is available at path.php
require_once 'Text/PathNavigator.php';
echo '<br><br>indexing methods';
echo '<br>get(2)='. $p->get (2 );
echo '<br>get(golden)='. $p->get ('golden');
echo '<br>slice(1)='. $p->slice (1 );
echo '<br>slice(-2,1)='. $p->slice (-2 , 1 );
echo '<br>slice(-1)='. $p->slice (-1 );
echo '<br><br>normalizing path according to slash value "/"';
echo '<br>original path="\test\ok\2\3\"';
$p->load ('\test\ok\2\3');
echo '<br>normalized path='. $p->path;
echo '<br><br>loading from arrays and strings';
$p->load (array ('test'=> 'ok', 2 , 3 ));
echo '<br>from array='. $p->path;
$p->load ('/test/ok/2/3');
echo '<br>from string='. $p->path;
echo '<br><br>toArray with no offset<br>';
echo '<br><br>toArray with offset 1<br>';
if ($nodes = $p->getIterator ()) {
echo '<br><br>using an ArrayIterator';
foreach ($nodes as $i => $node) {
normalizing path according to slash value "/"
original path="\test\ok\2\3\"
normalized path=test/ok/2/3
loading from arrays and strings
Array ( [test] => ok [2] => 3 )
Array ( [ok] => 2 [3] => )
Documentation generated on Mon, 11 Mar 2019 15:48:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|