Skip to content

Instantly share code, notes, and snippets.

@mathiasverraes
Created October 29, 2012 14:41
Show Gist options
  • Save mathiasverraes/3973917 to your computer and use it in GitHub Desktop.
Save mathiasverraes/3973917 to your computer and use it in GitHub Desktop.
$jim_price = $hannah_price = new Money(2500, new Euro);
$coupon = new Money(500, new Euro);
$jim_price->subtract($coupon);
$jim_price->equals($hannah_price); // true
$jim_price = $jim_price->subtract($coupon);
$jim_price->lessThan($hannah_price); // true
$jim_price->equals(Money::euro(2000)); // true
$profit = new Money(5, new Euro);
list($my_cut, $investors_cut) = $profit->allocate(70, 30);
list($investors_cut, $my_cut) = $profit->allocate(30, 70);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment