Last active
November 22, 2023 08:39
-
-
Save antimech/73b8a8788e7c906de2f76f8f1104f021 to your computer and use it in GitHub Desktop.
Калькулятор с использованием библиотеки chriskonnertz/string-calc. $ php calc.php и введите ваше выражение, например: 1+2*4+(4*4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php8.1 | |
<?php | |
// $ composer require chriskonnertz/string-calc:^2.0.0 | |
require __DIR__ . '/vendor/autoload.php'; | |
$stringCalc = new ChrisKonnertz\StringCalc\StringCalc(); | |
$term = trim(fgets(STDIN)); // reads one line from STDIN | |
$result = $stringCalc->calculate($term); | |
echo $term . '=' . $result . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment