PHP Classes

PHP Dictionary to Array class: Manipulate value collections as arrays or objects

Recommend this page to a friend!
  Info   View files Example   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 100 All time: 9,733 This week: 154Up
Version License PHP version Categories
xdict 1.0.0Custom (specified...5.6PHP 5, Data types
Description 

Author

This package can manipulate value collections as arrays or objects.

It provides interfaces that can make objects act as arrays and so operate in a way that all functions that work with arrays, as if the objects were real arrays.

The package also performs operations with array elements like combining, merging, filtering, listing, reversing, shuffling, sorting, queing, map and reducing, etc..

Picture of zinsou A.A.E.Mo´se
  Performance   Level  
Name: zinsou A.A.E.Mo´se is available for providing paid consulting. Contact zinsou A.A.E.Mo´se .
Classes: 50 packages by
Country: Benin Benin
Age: 33
All time rank: 6831 in Benin Benin
Week rank: 21 Up1 in Benin Benin Equal
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Example

<?php
require_once('./../xdict.class.php');
echo
'<pre>';
highlight_string('<?php
$x=xdict(0);
for ($i=0;$i<5;$i++){
    $x[]=$i*3;
}

$y=new xDict();

var_dump(
is_xdict($x),
is_xdict($y),
is_xdict(new Exception()),
is_xdict(4)
);

?>'
);
$x=xdict(0);
for (
$i=0;$i<5;$i++){
   
$x[]=$i*3;
}

$y=new xDict();

var_dump(
is_xdict($x),
is_xdict($y),
is_xdict(new Exception()),
is_xdict(4)
);
highlight_string('<?php
$x->swap(0,4);
$x->rotate(3);
$x->rotate(2);
$x->rotate(-4);
$x->insert(2,"this is the new 2 value and the previous has been assigned to 3");
echo(count($x))."<br>";
var_dump(
$x->contains(0,3,9,12,30),
$x->contains(0,3,9,12,31),
$x->contains(9,12,3),
$x->in_xdict(42),
$x->in_xdict(30),
$x->in_xdict(\'mamamia\')
);
echo json_encode($x,JSON_PRETTY_PRINT|JSON_FORCE_OBJECT)."<br>";
?>'
);

$x->swap(0,4);
$x->rotate(3);
$x->rotate(2);
$x->rotate(-4);
$x->insert(2,31);
echo(
count($x))."<br>";
var_dump(
$x->contains(0,3,9,12,30),
$x->contains(0,3,9,12,31),
$x->contains(9,12,3),
$x->in_xdict(42),
$x->in_xdict(30),
$x->in_xdict('mamamia')
);
echo
json_encode($x,JSON_PRETTY_PRINT|JSON_FORCE_OBJECT)."<br>";

highlight_string('<?php
$x->rewind();
while(list($k,$v)=$x->each()){
    echo $k.":".gettype($v)."<br>"; //just to test each method but you can use $x->typesof() to know all the used types even recursively
}
?>'
);

$x->rewind();
while(list(
$k,$v)=$x->each()){
    echo
$k.":".gettype($v)."<br>"; //just in order to test each method but you can use $x->typesof() to know all the used types even recursively
}

highlight_string('<?php
var_dump(
$x->signature(),
$x->typesof(),
$x->homogeneous(),
$x->rowsandcol(),
$x->depth(),
$x->min(),
$x->max(),
$x->pseudoMiddle(true),
$x->sum(),
$x->product(),
$x->join(\'_\'),
$x->hash()
);
?>'
);

var_dump(
$x->signature(),
$x->typesof(),
$x->homogeneous(),
$x->rowsandcol(),
$x->depth(),
$x->min(),
$x->max(),
$x->pseudoMiddle(true),
$x->avg(),
$x->sum(),
$x->product(),
$x->join('_'),
$x->hash()
);


highlight_string('<?php
$r=xdict(0,\'k\');
$r->range(1,5,2);
$r->print_xr();
$r->range(\'a\',\'z\',2);
$r->print_xr();

?>'
);


$r=xdict(0,'k');
$r->range(1,5,2);
$r->print_xr();
$r->range('a','z',2);
$r->print_xr();

highlight_string('<?php
$r=xdict(0);
$r->range(1,20,2);
// $r->print_xr();
var_dump($r->pseudoMiddle(true),$r->pseudoMiddle());
$r=xdict(0);
$r->range(1,120,2);
// $r->print_xr();
var_dump($r->pseudoMiddle(true),$r->pseudoMiddle());
$r=xdict(0);
$r->range(0,120,2);
$r->shuffle();
// $r->print_xr();
var_dump($r->pseudoMiddle(true));
$r=xdict(0);
$r->range(\'a\',\'z\',2);
// $r->print_xr();
var_dump($r->pseudoMiddle(true)); //return null because there are no numeric in this xDict object
$r=xdict(0);
$r->range(-75,45.6,12.6);
$r->print_xr();
var_dump($r->pseudoMiddle(true));
?>'
);
$r=xdict(0);
$r->range(1,20,2);
// $r->print_xr();
var_dump($r->pseudoMiddle(true),$r->pseudoMiddle());
$r=xdict(0);
$r->range(1,120,2);
// $r->print_xr();
var_dump($r->pseudoMiddle(true),$r->pseudoMiddle());
$r=xdict(0);
$r->range(0,120,2);
$r->shuffle();
// $r->print_xr();
var_dump($r->pseudoMiddle(true));
$r=xdict(0);
$r->range('a','z',2);
var_dump($r->pseudoMiddle(true)); //return null because there are no numeric in this xDict object$r=xdict(0);
// $r->print_xr();
$r=xdict(0);
$r->range(-75,45.6,12.6);
$r->print_xr();
var_dump($r->pseudoMiddle(true));


highlight_string('<?php
$r=xdict(0,\'\',true,false,6);//pay attention to the last argument for it force the xDict object to have a limited length: here 6
$r->range(1,20,2);
$r->print_xr();
?>'
);
$r=xdict(0,'',true,false,6);//pay attention to the last argument for it force the xDict object to have a limited length: here 6
$r->range(1,20,2);
$r->print_xr();
?>


  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file Misc.php Example example script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:100
This week:0
All time:9,733
This week:154Up