간단한 for 문 도와주세요..ㅠ.ㅠ > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

간단한 for 문 도와주세요..ㅠ.ㅠ 정보

간단한 for 문 도와주세요..ㅠ.ㅠ

본문

if($bo_table =="board4_1"||$bo_table =="board4_2"||$bo_table =="board4_3"||$bo_table =="board4_4"||$bo_table =="board4_5"
||$bo_table =="board4_6"||$bo_table =="board4_7"||$bo_table =="board4_8"||$bo_table =="board4_9"||$bo_table =="board4_10"){ //고객센터
  include_once("$g4[path]/menu/help.php");


이렇게 1번부터 10번까지 반복해서 쓰는데..
for문으로 어떤식으로 작성하면 좋을까요?
  • 복사

댓글 전체

<?
$chk = false;
for($k=1; $k<11; $k++)
{
    if($bo_table == "board4_{$k}"){
        $chk = true;
        break; // 계속 돌필요없이 끊는다.
    }
}
if($chk)
    include_once "{$g4['path']}/menu/help.php";
?>
© SIRSOFT
현재 페이지 제일 처음으로