How does {code...} implement $ a. $ c. $ B to output 0? Can the input, subtraction, multiplication, division, and dynamic computing results be achieved?
$ A = 1; $ B = 1; $ c = '-'; echo $ a. $ c. $ B; // 1 + 1
How to Implement$ A. $ c. $ BOutput 0?
Can the input, subtraction, multiplication, division, and dynamic computing results be achieved?
Reply content:
$ A = 1; $ B = 1; $ c = '-'; echo $ a. $ c. $ B; // 1 + 1
How to Implement$ A. $ c. $ BOutput 0?
Can the input, subtraction, multiplication, division, and dynamic computing results be achieved?
Echo eval ("return {$ a} {$ c} {$ B };");
For more information about eval, see
Echo $ a. '-'. $ B. '='. ($ a-$ B );
Switch ($ c ){
Case '+ ':
Echo $ a + $ B; break;
Case '-':
Echo $ a-$ B; break;
Case '*':
Echo $ a * $ B; break;
Case '/':
Echo $ a/$ B; break;
Default:
Echo "input error ";
}