// 00000000 //00000000代表全部灯灭。 // // echo "<br />灯1是亮着"; } else { echo "<br />灯1是灭的"; } //需求1b:请输出灯泡2的状态; if (($state & D2) > 0) { echo "<br />灯2是亮着"; } else { echo "<br />灯2是灭的"; } function ShowAll() { echo "<p>"; for ($i = 1; $i <= 5; ++$i) { $s = "D" . $i; if (($GLOBALS['state'] & constant($s)) > 0) { echo "灯{$i}亮着<br />"; } else { echo "灯{$i}灭着<br />"; } } } ShowAll(); ?> </body> </html>
fwrite($myfile, $info[$i]->age); fwrite($myfile, " "); fwrite($myfile, $info[$i]->school); fwrite($myfile, " "); fwrite($myfile, "@"); } } function Exit1() { return exit; } switch ($i) { case "Add": Add($name, $age, $school); break; case "Delete by name": Delete1($info); break; case "Show all": ShowAll($info); break; case "Sort by name": Sort1($info); break; case "Exit": Exit1(); break; default: echo "Reclick the button!"; break; }