数组比较 php比较两个数据判断用户提交的表单数据是否已经存在
php比较两个数据判断用户提交的表单数据是否已经存在 [代码片段(18行)]
<?php $choices = array('my choice 1', 'my choice 2', 'my choice 3'); $valid = true; if (is_array($_GET['inputArray'])) { $valid = true; foreach($_GET['inputArray'] as $input) { if (!in_array($input, $choices)) { $valid = false; } } if ($valid) { echo "Input Value were found in choices"; } } ?>
精彩图集
精彩文章