php - 为什么我的产出价值翻了一番?如何在不加倍的情况下存储每个文件的确切值?
问题描述
foreach ($fileContent as $stData){
while(!feof($f)) {
$stData = explode(',', trim(fgets($f, 1024)));
if ((filter_var($stData[1], FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>100))))&& preg_match('/^\d{8}$/', $stData[0])){
echo $stData[0]. " : " . $stData[1]. "</br>";
$goodStudents[] = $stData;
}elseif ((filter_var($stData[1], FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>100)))==false)&& preg_match('/^\d{8}$/', $stData[0])) {
echo $stData[0]. " : " . $stData[1]. " : Incorrect mark : not included </br>";
} else {
echo $stData[0]. " : " .$stData[1]. " : Incorrect ID : not included </br>";
}
}//while
};//foreach student & mark
print_r (count($goodStudents));
输出:
12345678 : 56
3456782:67:不正确的 ID:不包括在内
12324654 : 98
23476901:53
12563792:49
74537299:7
99834511:50
77625489 : 56
55274559:63
22009643:711:不正确的标记:不包括在内
8 ---存储的数组
12345678 : 56
34567822:67
12324654 : 98
234769O1:45:不正确的 ID:不包括在内
12563792:49
74537299:7I:不正确的标记:不包括
99834511:50
77625489 : 56
55274559:63
22009643 : 71
72578129 : 51
17 -----存储的数组加倍-----
解决方案
推荐阅读
- ios - 如果 IBOutlet 在 UIViewController 类中,如何访问 UITableViewController 类中的 IBOutlet
- docker - Netstat 未显示 docker 暴露的端口
- javascript - 对预检请求的响应未通过访问控制检查 (JavaScript)
- javascript - 如何处理程序的异步执行?
- javascript - 如何在多个 Vue 应用程序之间共享一个令牌
- javascript - 反应组件没有重新渲染,尽管道具中的对象发生了变化
- java - 我正在尝试编写一个使用方法重载来打印我的语句的代码
- amazon-ec2 - 尝试使用 scp 从 EC2 下载文件返回 No such file or directory 即使文件存在
- python - Outlier removal on a variable with several rows contain NAN (I need to keep the NAN and the position of the NAN also matters)
- java - 应用程序启动方法异常 - JavaFX