Here is a simple example on extraction to global variable details.Of course you can use any of the PHP <br>
Native extract function Flags as stated in the doc <?php
require_once('./../xdict.class.php');
echo '<pre>';
highlight_string('<?php
$x=xdict(0,\'_\'/*can be empty string*/,true/*or false*/,true/*or false*/,10 /*will limit number of entry to 10,by default it is unlimited*/);
for ($i=0;$i<15;$i++){
$x[]=$i*3;
}
var_dump($x);
$x->extract();
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
// echo $_10;echo "<br>";//print undefined it is normal because the xDict object is limited to ten entries actually
$x->extract(EXTR_PREFIX_SAME,\'xdict\');
echo $xdict__1;echo "<br>";
echo $xdict__2;echo "<br>";
echo $xdict__3;echo "<br>";
echo $xdict__4;echo "<br>";
echo $xdict__5;echo "<br>";
echo $xdict__6;echo "<br>";
echo $xdict__7;echo "<br>";
echo $xdict__8;echo "<br>";
echo $xdict__9;echo "<br>";
// echo $_10;echo "<br>";//print undefined it is normal because the xDict object is limited to ten entries actually
$x->extract(EXTR_REFS|EXTR_PREFIX_SAME,\'xDict\');
for($i=0;$i<10;$i++){
${\'xDict__\'.$i}=1;
}
var_dump($x);
$x->extract(EXTR_SKIP);
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
$x->extract(EXTR_OVERWRITE);
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
?>');
$x=xdict(0,'_'/*can be empty string*/,true/*or false*/,true/*or false*/,10 /*will limit number of entry to 10,by default it is unlimited*/);
for ($i=0;$i<15;$i++){
$x[]=$i*3;
}
var_dump($x);
$x->extract();
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
// echo $_10;echo "<br>";//print undefined it is normal because the xDict object is limited to ten entries actually
$x->extract(EXTR_PREFIX_SAME,'xdict');
echo $xdict__1;echo "<br>";
echo $xdict__2;echo "<br>";
echo $xdict__3;echo "<br>";
echo $xdict__4;echo "<br>";
echo $xdict__5;echo "<br>";
echo $xdict__6;echo "<br>";
echo $xdict__7;echo "<br>";
echo $xdict__8;echo "<br>";
echo $xdict__9;echo "<br>";
// echo $_10;echo "<br>";//print undefined it is normal because the xDict object is limited to ten entries actually
$x->extract(EXTR_REFS|EXTR_PREFIX_SAME,'xDict');
for($i=0;$i<10;$i++){
${'xDict__'.$i}=1;
}
var_dump($x);
$x->extract(EXTR_SKIP);
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
$x->extract(EXTR_OVERWRITE);
echo $_1;echo "<br>";
echo $_2;echo "<br>";
echo $_3;echo "<br>";
echo $_4;echo "<br>";
echo $_5;echo "<br>";
echo $_6;echo "<br>";
echo $_7;echo "<br>";
echo $_8;echo "<br>";
echo $_9;echo "<br>";
highlight_string('<?php
$y=xdict(0,\'k\');
for ($i=0;$i<3;$i++){
$y[]=$i*3;
}
$y->print_xr();
$y->listvar($min,$middle,$max);// PHP list structure equivalent in method but more restrictive as it uses references
var_dump($min,$middle,$max);
$y->strict=false;
$y->compact(\'min\',\'middle\',\'max\',array(\'x\'));//PHP compact function equivalent in method. work only with strict mode off
$y->print_xr();
?>');
$y=xdict(0,'k');
for ($i=0;$i<3;$i++){
$y[]=$i*3;
}
$y->print_xr();
$y->listvar($min,$middle,$max);// PHP list structure equivalent in method but more restrictive as it uses references
var_dump($min,$middle,$max);
$y->strict=false;
$y->compact('min','middle','max',array('x'));//PHP compact function equivalent in method. work only with strict mode off
$y->print_xr();
?>
|