array2에 array1에서 임의의 값 (임의로 생성 된 값)이 있는지 확인해야 할 때가 왔습니다. 지금까지의
고토 해결 방법
redo : $id=mt_rand(0,count(array1));
foreach($array2 as $arr)
{
if($arr[0]==$id) goto redo;
}
//Some actions if randomly generated value from array1 wasn't found in array2
생각하지만 난 정말 고토를 사용하지 않으려는 것입니다.
이
do {$ id = mt_rand (...); $ contains =/* 배열에이 id가 들어 있는지 판단 * /; } 012 ($ contains);' – DCoder
적절한 구조 (do-while)를 제안대로 사용하고 기억하십시오 ... ** 절대로 절대로 ** 결코 ** 고토 ** 연산자를 사용하지 마십시오. 그것은 농담. 실제의 경우 : [PHP 매뉴얼] 하단의 [만화] (http://it.php.net/manual/en/images/0baa1b9fae6aec55bbb73037f3016001-xkcd-goto.png) (http : // it. php.net/manual/en/control-structures.goto.php) –
그 그림을 보았습니다 : P –