PHP becomes better every day, but some bad things aren’t go away. One of this is the primitive type, not available as object.
This librairy avoids this by allowing use of objects for string, character, array, hash and number.
To be used in place of primitive type, classe's names must be short, very short. So, just declare class to use at the start, and then use only one letter! S for string, C for character, A for array, H for name-index array (hash) and N for numeric values.
use \Malenki\Bah\S; // For string
use \Malenki\Bah\C; // For one char string
use \Malenki\Bah\A; // For array
use \Malenki\Bah\H; // For name-indexed array
use \Malenki\Bah\N; // For numeric values
Unless exceptions, all methods are chainable, so you can return each type of Bah after each method call, and avoid use of lot of transition variables!
use \Malenki\Bah\S;
$s = new S('This is a string!');
// print ' THIS '
echo $s->upper->sub(4)->center(12);
Use old page encoding like iso-8859-15 and its friends it is very bad idea since some years, so, Bah! discourages the use of this dinosaurs by forcing you to use UTF-8 only! This is visible for example into C class.
use \Malenki\Bah\C;
$c = new C('œ');
// Print the unicode block name
echo $c->block;
A lot of methods have not params or take a default one. So, for this, magic getters are enough, no need to put parenthesis when it is not needed!
use \Malenki\Bah\A;
$a = new A(array('un', 'deux', 'trois', 'quatre'));
echo $a->join->upper->length;
// print 17;