PHP code example of chkt / ash

1. Go to this page and download the library: Download chkt/ash library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chkt / ash example snippets


  $baseFactory = new \eve\common\factory\BaseFactory();
  $parserFactory = new \ash\ParserFactory($baseFactory);

  $parser = $parserFactory->produce();
  $solver = $parser->parse('a + b');

  $result = $solver->resolve([ 
    'a' => 1,
    'b' => 2 
  ]);

  $solver = $parser->parse('baz[ foo() ]');
  
  $context = [
      'foo' : function() : string { return 'bar'; },
      'baz' => [ 'bar' => 'qux' ]]
    ];
  $result = $solver->resolve($context);
bash
$ php composer.phar install chkt/ash