RegexTest.php 308 B

12345678910111213141516
  1. <?php
  2. require __DIR__ . '/../../vendor/autoload.php';
  3. use Parse\RegexParser;
  4. {
  5. $parser = new RegexParser(
  6. "#^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?#",
  7. function ($match) {
  8. return (float)$match;
  9. }
  10. );
  11. var_dump($parser->parse("-1234.5") === -1234.5);
  12. }