PHP code example of anikin-elets / correct-brackets

1. Go to this page and download the library: Download anikin-elets/correct-brackets 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/ */

    

anikin-elets / correct-brackets example snippets


$line = '()()(    )()()';
$allowedChars = ['(', ')', '\r', '\n', '\t', '\s'];

$bracketLibrary = new \Library\Command\BracketCommand($line, $allowedChars);
try {
    $isCorrect = $bracketLibrary->execute();
} catch (\Library\Exceptions\InvalidArgumentException $e) {
    echo sprintf("ERROR: %s", $e->getMessage());
}