PHP code example of zhuravljov / calc

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

    

zhuravljov / calc example snippets


$calculator = new \zhuravljov\calc\Calculator();
$calculator->calc('2 + 2 * 2'); // 6
$calculator->calc('(2 + 2) * 2'); // 8
$calculator->calc('(2 + 2'); // CalcException