在此示例中,如何计算每行中有多少 NULL 值、多少个零 (0) 和多少个 (1) 以及每个值存储在变量中。
+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
| StdID | day1S1 | day1S2 | day1S3 | day2S1 | day2S2 | day2S3 | day3S1 | day3S2 | day3S3 |
+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
| 3 | NULL | 1 | 0 | 1 | 1 | 0 | NULL | 1 | 1 |
| 4 | 1 | 1 | 0 | 1 | 0 | 0 | NULL | 1 | 1 |
+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
开/关
**StdID = 3**
$null = 2;
$zeros = 2;
$ones = 5;
**StdID = 4**
$null = 1;
$zeros = 3;
$ones = 5;
我不知道该怎么做,但我正在尝试使用以下代码
$check = isset($day1['day1S1']) ? "1" : "0"; doesnt work
$values = $day1['day1S1']+$day1['day1S2']+$day1['day1S3'] etc
请帮我解决这个问题。谢谢
慕盖茨4494581