<?php $scores = [45, '23', 1]; $scores_string = ''; $len = count($scores); for ($i = 0; $i < $len; $i++) { if (empty($scores[$i]) || !is_numeric($scores[$i])) { $scores_string = 'You must enter three valid numbers for scores.'; break; } } if ($scores_string != '') { echo $scores_string; // do anything else you need } else { // all is OK! }
You have javascript disabled. You will not be able to edit any code.