There is:

$help = array(1;2;3;6;7,9) $arr = explode(";", $help)); $colnum=400; for ($i = 1; $i <= colnum; $i++) { if ($i==$arr)continue; echo '$i,'; } 

It should turn out 4,5,8,10,11,12,13,14 ... 400

How to write a for control construct (possibly using a while) to successfully output the necessary values?

    2 answers 2

    You can check using the in_array function.

     if(!in_array($i, $arr)){echo '$i,'} 
    • I thought the system would go over the condition once and the second number from the condition would not be taken into account, so I didn’t use it, but no, everything is fine. - Dvashington
     $arr = [1,2,3,6,7,9]; $range = range(1, 400); $result = array_diff($range, $arr); 
    • Your decision is also the right one - Dvashington