I encountered this problem when I was studying PHP today. {Code...} shows the result {code...} does not show the result. Isn't the code at both ends the same? I encountered this problem when I was studying PHP today.
Function filter ($ fun) {for ($ I = 0; $ I <= 100; $ I ++) {if (call_user_func_array ($ fun, array ($ I ))) continue; echo $ I."
";}}// Calculate the divisible function one ($ num) {return $ num % 3 = 0;} // flip the string function two ($ num) {return $ num = strrev ($ num);} filter ("one"); echo"
"; Filter ('two ');
Display result
Function filter ($ fun) {for ($ I = 0; $ I <= 100; $ I ++) {if (call_user_func_array ($ fun, array ($ I ))) {continue; echo $ I."
";}}// Returns the divisible function one ($ num) {return $ num % 3 = 0;} // flip the string function two ($ num) {return $ num = strrev ($ num);} filter ("one"); echo"
"; Filter ('two ');
The result is not displayed. Isn't the code at both ends the same?
Reply content:
I encountered this problem when I was studying PHP today.
Function filter ($ fun) {for ($ I = 0; $ I <= 100; $ I ++) {if (call_user_func_array ($ fun, array ($ I ))) continue; echo $ I."
";}}// Calculate the divisible function one ($ num) {return $ num % 3 = 0;} // flip the string function two ($ num) {return $ num = strrev ($ num);} filter ("one"); echo"
"; Filter ('two ');
Display result
Function filter ($ fun) {for ($ I = 0; $ I <= 100; $ I ++) {if (call_user_func_array ($ fun, array ($ I ))) {continue; echo $ I."
";}}// Returns the divisible function one ($ num) {return $ num % 3 = 0;} // flip the string function two ($ num) {return $ num = strrev ($ num);} filter ("one"); echo"
"; Filter ('two ');
The result is not displayed. Isn't the code at both ends the same?
for($i=0; $i<=100; $i++){ if(call_user_func_array($fun, array($i))) continue; echo $i."
"; }
Equivalent
for($i=0; $i<=100; $i++){ if(call_user_func_array($fun, array($i))){ continue; } echo $i."
"; }
Whether it is true or not, php will be executed. php is not python. It is not to say that indentation is a statement block.
Php's if is the same as C's if.
If you do not increase the brackets, you can use semicolons (;). Braces (_) are added to the braces.
for($i=0; $i<=100; $i++){ if(call_user_func_array($fun, array($i))){ continue; echo $i."
"; } }
This program is wrong, becauseecho $i."
";
Will never be executed
if(true){}
:
php
If (true) {// the code in the curly braces will be executed}
Whileif(true)
:
php
If (true) echo (233); // only this echo (233); it belongs to if to judge echo time ();
The difference isif(true)
Only the following sentence must be followed: the condition is that the Code is actually executed, andif(true){}
The code in the curly braces of is the Execution Code with a condition, andCan be empty