PHP Classes

File: examples/FilterAndCo.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   PHP Dictionary to Array class   examples/FilterAndCo.php   Download  
File: examples/FilterAndCo.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,257 bytes
 

Contents

Class file image Download
<?php
require_once('./../xdict.class.php');
echo
'<pre>';
highlight_string('<?php
function odd($var)
{
    return($var & 1);
}

function even($var)
{
    return(!($var & 1));
}
$x=xdict(0,"",false);
$x->fill_with(array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5));

$y=xdict(0,"",false);
$y->fill_with(array(6, 7, 8, 9, 10, 11, 12));

echo "odd :\n";
print_r($x->filter("odd"));
echo "Even :\n";
print_r($y->filter("even"));
?>'
);
function
odd($var)
{
    return(
$var & 1);
}

function
even($var)
{
    return(!(
$var & 1));
}
$x=xdict(0,"",false);
$x->fill_with(array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5));

$y=xdict(0,"",false);
$y->fill_with(array(6, 7, 8, 9, 10, 11, 12));

echo
"odd :\n";
print_r($x->filter("odd"));
echo
"Even :\n";
print_r($y->filter("even"));
highlight_string('<?php
$w=xdict(0,"",false);
$w->fill_with(array(6, 7, 8,8, 9, 10, 11, 12,12,$u=xdict(),&$u,&$u));
echo "unique :\n";
print_r($w->unique(SORT_STRING));
echo "count values :\n";
print_r($w->count_values());
?>'
);

$w=xdict(0,"",false);
$w->fill_with(array(6, 7, 8,8, 9, 10, 11, 12,12,$u=xdict(),&$u,&$u));
echo
"unique :\n";
print_r($w->unique(SORT_STRING));
echo
"count values :\n";
print_r($w->count_values());
?>