Advertisement
kotvalera83

Untitled

Aug 9th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  1. <?php
  2. $str = "(()()()()()((()))))";
  3. $open = substr_count($str, "(");
  4. $close = substr_count($str, ")");
  5. if($open === $close){
  6.   echo "Строка сбалансирована\n";
  7. }else{
  8.     echo "Строка не сбалансирована\n";
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement