= 0 ;$i--){ $tmpCnt += getCountVal($s[$i]); if($tmpCnt === 0){ break; } } } print $i + 1; function getCountVal($i_string){ if($i_string === "("){ return 1; }else{ return -1; } }