Php uses a trielement function to determine the parity error of numbers. how can I solve Parse error: syntax error, unexpected 'echo '(T_ECHO) in F: \ xampp \ htdocs \ test \ test02.php on line 26 this is an error description,
The source code is as follows:
For ($ a = 0; $ a <10; $ a ++ ){
// Output with a trielement operation. if there is no remainder, it is an even number,
Otherwise, it is an odd number.
Echo $ a % 2 = 0? $ A. "is an even number". "\ n": $ a. "is an odd number". "\ n ";
}
?>
Reply to discussion (solution)
// Otherwise, it is an odd number.
Thanks
The double slash is missing.
For ($ a = 0; $ a <10; $ a ++ ){
// Outputs the result using a ternary operation. if there is no remainder, the output result is an even number. Otherwise, the output result is an odd number.
Echo $ a % 2 = 0? $ A. "is an even number". "\ n": $ a. "is an odd number". "\ n ";
}
For ($ a = 0; $ a <10; $ a ++) {// outputs the result using a ternary operation. if there is no remainder, the result is an even number, // otherwise, it is an odd echo $ a % 2 = 0? $ A. "is an even number". "\ n": $ a. "is an odd number". "\ n ";}
0 is an even number. 1 is an odd number. 2 is an even number. 3 is an odd number. 4 is an even number. 5 is an odd number. 6 is an even number. 7 is an odd number. 8 is an even number. 9 is an odd number.