PHP Classes

File: examples/FlipReverseAndShuffle.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   PHP Dictionary to Array class   examples/FlipReverseAndShuffle.php   Download  
File: examples/FlipReverseAndShuffle.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP Dictionary to Array class
Manipulate value collections as arrays or objects
Author: By
Last change:
Date: 6 years ago
Size: 1,463 bytes
 

Contents

Class file image Download
<?php
require_once('./../xdict.class.php');
echo
'<pre>';
highlight_string('<?php
$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,\'k\',true,true,4)));
print_r($a->reverse());
print_r($a->flip());
$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,\'k\',true,true,4),"j"=>"banana","k"=>"banana"));
print_r($a->flip());
$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,\'k\',true,true,4),"j"=>"banana","k"=>"banana"));
$a->flip(false)->print_xr();

$y=xdict(0,\'k\');
for ($i=0;$i<3;$i++){
    $y[]=$i*3;
}

$y->shuffle();// preserve keys
$y->print_xr();
$y->shuffle(false);//re-index
$y->print_xr();
?>'
);

$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,'k',true,true,4)));
print_r($a->reverse());
print_r($a->flip());
$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,'k',true,true,4),"j"=>"banana","k"=>"banana"));
print_r($a->flip());
$a=xdict(0,"",false);
$a->fill_with(array("d"=>"avocado", "e"=>"apple", "f"=>"banana","i"=>xdict(0,'k',true,true,4),"j"=>"banana","k"=>"banana"));
$a->flip(false)->print_xr();

$y=xdict(0,'k');
for (
$i=0;$i<10;$i++){
   
$y[]=$i*3;
}

$y->shuffle();// preserve keys
$y->print_xr();
$y->shuffle(false);//re-index
$y->print_xr();


?>