📄 06c05-1.php
字号:
<?php// Define a few functions that echo different strings, based upon whether// the number is divisible by a certain other number.$divisible = array( 1 => create_function('$n', 'echo "<p>Of course $n is divisible by 1, everything is!</p>";'), 2 => create_function('$n', 'if ($n % 2 == 0) { echo "<p>$n is divisible by 2. It is even.</p>"; }'), 3 => create_function('$n', 'if ($n % 3 == 0) { echo "<p>$n is divisible by 3.</p>"; }'), 4 => create_function('$n', 'if ($n % 4 == 0) { echo "<p>$n is divisible by 4. It is double-even!</p>"; }'), 5 => create_function('$n', 'if ($n % 5 == 0) { echo "<p>$n is divisible by 5. It therefore ends in a 0 or a 5.</p>"; }'), );// Now loop through these functions, calling them all on the number 2000// They will be true for all cases except for '3'foreach($divisible as $func) { $func(2000);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -