PHP Classes

File: src/NXP/Classes/Tokenizer.php

Recommend this page to a friend!
  Classes of Alexander Kiryukhin  >  PHP Math Expression Evaluator  >  src/NXP/Classes/Tokenizer.php  
File: src/NXP/Classes/Tokenizer.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Math Expression Evaluator
Parse and evaluate strings with math expressions
Author: By
Last change: Space should end open numbers (#113)
Added ability to escape quotes in strings. (#110)

* Added ability to escape quotes in strings.

* Removed type checking for customfunc arguments. It was a bad idea to check types, because php automatically tries to convert a parameter to required type and throws if it failures. On the other hand, we can check types also in callables if required.

* Update phpdoc

* Fix some typos + improve min, max, avg funcs.

* Update readme + improvements.

* Fix a typo in sample.

* Fix unshown backslash in readme.
Full support for arrays => min, max and avg funcs accept array argument. Also array function is defined which return arguments as array. Square bracket arrays are also supported. (#108)

valid expression -> "max([1,2,3])"
valid expression -> "max(array(1,2,3))"
valid expression -> "max($ages_arr)"
valid expression -> "max(ages_arr())"
Support unlimited args for min, max default funcs. (#106)

* Support unlimited args for min, max default funcs.

Default functions max and min were requiring 2 arguments strictly. Now they supoort unlimited args, same as php's min, max funcs.

* Improved functions: support unlimited parameters (see min, max funcs), optional parameters (see round func), parameters with types (see round func, throws IncorrectFunctionParameterException on unmatched type, union types and intersection types not supported because of min php level! there is a todo for this, to support them later @see CustomFunction@execute) Also added unittests for improvements.

* Run php-cs-fixer fix
Date: 4 months ago
Size: 13,892 bytes

You need to be a registered user and login to get this file.

1,601,891 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

FacebookGmailHotmailStackOverflowGitHubYahoo
For more information send a message to info at phpclasses dot org.