3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $grades=array(-4,-1,0,1,6,10,70,99,100,101,105,110); foreach($grades as $grade){ if( ($grade+1)*(101-$grade) > 0 ){ // ($grade minus negative [lower limit])*([upper limit] plus $grad) $validGrades[] = $grade; }else{ $invalidGrades[] = $grade; } } var_export($validGrades); var_export($invalidGrades);
based on EEXLJ
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
array ( 0 => 0, 1 => 1, 2 => 6, 3 => 10, 4 => 70, 5 => 99, 6 => 100, )array ( 0 => -4, 1 => -1, 2 => 101, 3 => 105, 4 => 110, )