From 8944b4e2ca31a809cb40725fe479103517c6c6ed Mon Sep 17 00:00:00 2001 From: Lico San Date: Mon, 17 Jun 2019 14:04:12 +0200 Subject: [PATCH] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6121396..2073b1d 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,24 @@ $f1 = new Formula1('-45+(41*2)-(6/(3+1))'); echo($f1->compute()); // 35.5 ``` +```PHP +// With rounding (third and fourth params are precision and mode, like for the round function) +$f1 = new Formula1('2/6', [], 3); +echo($f1->compute()); // 0.667 +``` + **Simple usage with variables** ```PHP $f1 = new Formula1('-45+(fourty_one*2)-(6/(three+1))' , ['fourty_one'=>41, 'three'=>3]); -echo($f1->compute()); +echo($f1->compute()); // 35.5 ``` **Funky usage with variables that include formulas themselves (and recusrively)** ```PHP $f1 = new Formula1('-45+(fourty_one*2)-(6/(three+1))' , ['fourty_one'=>'82/2', 'three'=>'12/four', 'four'=>4]); -echo($f1->compute()); +echo($f1->compute()); // 35.5 ``` ## TODO