About Us
Team
Values
Support
Open Source: dbentity
Overview
Download
Presentations and Articles
Examples: DBEntity Calling
Examples: DBEntity Classes
Examples: DBEntity Syntax
Examples: DB
Examples: DBQUERY
Examples: RBA
FAQ
Contact
ABOUT US
DBEntity - RBA - Examples

$arr = array('a' => 1, 'b' => 2, 'c' => 3);

// all of the arrays that follow are equivalent to the array above.

// rba::_(...) is a way of creating arrays... an intelligent merge function
$arr2 = rba::_('a', 1, 'b', 2, 'c', 3);
$arr3 = rba::_('a', 1, array('b' => 2, 'c' => 3));

// the '-' is a special key which removes whatever is next.
$arr4 = rba::_('a', 1, array('b' => 2, 'c' => 3, 'd' => 4), '-', 'd');

// rba::__(...) just calls rba::_ on a list of argments.
$arr5 = rba::__(array('a', 1, 'b', 2, 'c', 3));

// usually, rba::__ is used to gather up arguments passed into a function
$arr6 = test('a', 1, 'b', 2, 'c', 3);

// subset
$arr7 = rba::subset(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), 'a', 'b', 'c');
$arr8 = rba::subset(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), array('a', 'b', 'c'));

// rmkeys
$arr9 = rba::rmkeys(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), 'd');
$arr10 = rba::rmkeys(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), array('d'));

// rmvalues
$arr11 = rba::rmvalues(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), 4);
$arr12 = rba::rmvalues(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), array(4));

// renamekeys
$arr13 = rba::rename_keys(array('a' => 1, 'b' => 2, 'zzz' => 3), array('zzz' => 'c'));

// assert that all of these are the same
for ($i = 2; $i <= 13; $i++) {
    assert('$arr == $arr' . $i);
}

/**
* test: illustration of rba::__
*/
function test() {
    $args = rba::__(func_get_args());
    return $args;
}