PHP code example of kasseler / compiler

1. Go to this page and download the library: Download kasseler/compiler 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/ */

    

kasseler / compiler example snippets


$compiler = new Compiler('substr|md5|is_array'); //allow functions
$compiler->run("is_array([1, 2, 3, 5])"); //return true
$compiler->run("substr('my function compile', 3, 8)"); //return string 'function'
$compiler->run("[1, 2, 3, 4, 5]"); //return array [1, 2, 3, 4, 5]
$compiler->run('{"assoc":[1, 2, 3, 4, 5]}'); //return assoc array ['assoc' => [1, 2, 3, 4, 5]]
$compiler->run("md5('654')"); //return hash md5 'ab233b682ec355648e7891e66c54191b'
$compiler->run("true"); //return boolean true