Skip to content

Commit

Permalink
Update README (#136)
Browse files Browse the repository at this point in the history
Replace the wrong method name `calculate()` with `execute()`
  • Loading branch information
shadoWalker89 authored Jun 10, 2024
1 parent a63e50e commit e35e414
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ $executor->addFunction('concat', function($arg1, $arg2) {return $arg1 . $arg2;})
Optional parameters:
```php
$executor->addFunction('round', function($num, int $precision = 0) {return round($num, $precision);});
$executor->calculate('round(17.119)'); // 17
$executor->calculate('round(17.119, 2)'); // 17.12
$executor->execute('round(17.119)'); // 17
$executor->execute('round(17.119, 2)'); // 17.12
```
Variable number of parameters:
```php
$executor->addFunction('average', function(...$args) {return array_sum($args) / count($args);});
$executor->calculate('average(1,3)'); // 2
$executor->calculate('average(1, 3, 4, 8)'); // 4
$executor->execute('average(1,3)'); // 2
$executor->execute('average(1, 3, 4, 8)'); // 4
```

## Operators:
Expand Down

0 comments on commit e35e414

Please sign in to comment.