Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $str = "(()()()()()((()))))";
- $open = substr_count($str, "(");
- $close = substr_count($str, ")");
- if($open === $close){
- echo "Строка сбалансирована\n";
- }else{
- echo "Строка не сбалансирована\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement