Linux
CentOS6 PHP7.3 Continue targeting switch is equivalent 메시지 안나오게 하기
아이티제어
2020. 9. 23. 10:39
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
위 메시지 가 나오는 소스가 while 과 for문안에 switch 문안에 continue 가 있는경우이다.
continue 와 break를 쓰는 문구
while($a조건){ #혹은 for문도 마찬가지.
switch($a변수){
case 'foo':
continue; #요게 위 에러가 발생하여 프로그램이 문제가 되는경우가 있다.
break;
}
}
#해결법 : composer 설치는 CentOS 7에서 가능하므로 PASS
#해결법 : switch 문을 if 문으로 바꾼다. 힘들어도 아는길이 가장 빠르다.!!
변환전 : switch ($a) { case 'a': break; case 'b' : break; }
변환후 : if($a) { if($a=='a'){} if($a=='b'){} }
#끝.