PHP Variable Collection
Functional Programming
Inspired by https://github.com/divarvel/PHPZ Functionality can be implemented using Underscore.php - http://brianhaveri.github.io/Underscore.php/
__string($lastName)->upperCase()->value();
__integer($money)->round(2)->value();
__double($money)->add($interest)->subtract($taxes)->value();
__collection($data)->map()->reduce()->value();
OR
use PHPVar\String;
use PHPVar\Double;
use PHPVar\Collection;
$lastName = new String();
echo $lastName->set('last name')
->upperCase()
->value();
echo $lastName->set('other name')
->upperCase(); // magic function to return string?
$money = new Double();
$money->set(1000000)
->add($interest)
->subtract($taxes);
$money = new Double(1000000);
echo $money->add($interest)
->subtract($taxes);
$balances = new Collection([100, 200, 300, 400]);
$total = $balances->map()->reduce()->cast(Double::Type)->add($interest)->subtract($taxes)->value();
Should this be created?
New thoughts ....