Solver for brackets problem
Library for solving the problem of the correct brackets closing, (*1)
Installation:
composer require f1r3starter/brackets
Using:
For using run:, (*2)
<?php
use brackets\Brackets;
$bracketsString = '((()))';
$solver = new Brackets($bracketsString);
var_dump($solver->isCorrect());
If you need to use square brackets:, (*3)
$solver->setOpenBracket('[');
$solver->setCloseBracket(']');
If you need to change the list of the allowed characters (note that special characters should be escaped with backslash ('\') symbol):, (*4)
$solver->setAllowedSymbols('a', 'b', 'c', '1', '\%', '\$');