https://github.com/zircote/expressive
https://github.com/zircote/expressive
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/zircote/expressive
- Owner: zircote
- Created: 2012-07-10T23:38:16.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-12-17T01:37:51.000Z (over 12 years ago)
- Last Synced: 2025-03-23T19:45:19.583Z (over 1 year ago)
- Language: PHP
- Size: 180 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Expressive
[](http://travis-ci.org/zircote/Expressive)
A PHP expression parser. This tool was largely inspired by snips of code I came across
on the web while looking for some form of an expression DSL. The approach inspired me
enough to feel it deserved sharing. Unfortunately these snippets had no name associated
with them and I am therefor unable to attribute the inspirative work to its inceptor.
## Use:
### Inline PHP
```php
bin/expr
math > (2+2)*sqrt(4)
8
math > exit
>
```
Supported Operations:
- `+` addition `2+2`
- `-` substraction `4-2`
- `/` division `4/2`
- `*` multiplication `2*2`
- `^` exponential `2^2`
- `sin` sine `sin(60)`
- `cos` cosine `cos(90)`
- `tan` tangent `tan(45)`
- `sqrt` square root `sqrt(4)`
- `exp` exponent `exp(12)`
[](https://bitdeli.com/free "Bitdeli Badge")