Hello, I am a beginner in php. I want to ask a few questions: PHPcode1. $ a3; $ b2; echo (int) $ a (int) $ B. why is the output 1.5? 2. HowcanyouhidethefactthatwebpagesarewritteninPHP? A. ByusingAddTypeapplicationX Hello, the new php beginner asked a few questions
PHP code
1. $ a = 3; $ B = 2; echo (int) $ a/(int) $ B why is the output 1.5? 2. How can you hide the fact that web pages are written in PHP? A. by using AddType application/X-httpd-php aspb. specify all file names without any dot and extensionc. by using. htaccess diretive in Apeched. all of the above3. explain Using Register Globals.
------ Solution --------------------
1. because 1)/is a division operator, not a division operator 2) (int) operator has a higher priority/
(Int) $ a/(int) $ B = 3/2 = 1.5
2. I select d
3. in the Using Register Globals scenario, the submitted variables can be directly used by the $ variable name.
However, security issues exist. we recommend that you do not use Register Globals.
------ Solution --------------------
(Int) acts on the variable, not the entire expression
(Int) ($ a/$ B); so the result is 1
2 In fact, these measures are not enough. it is best to re-compile apache, rewrite the web server output header, and hide the php information in the development language.
3 is a feature that is not recommended.
------ Solution --------------------
Upstairs two
In C, (int) a/(int) B is equal to 1.
This question comes from here.
The test site is the automatic transformation of the data type. why is the result of division between two integer types a floating point number?
------ Solution --------------------
Discussion
Upstairs two
In C, (int) a/(int) B is equal to 1.
This question comes from here.
The test site is the automatic transformation of the data type. why is the result of division between two integer types a floating point number?
------ Solution --------------------
Discussion
2 In fact, these measures are not enough. it is best to re-compile apache, rewrite the web server output header, and hide the php information in the development language.
------ Solution --------------------
It seems that something meaningless has gone. Or there is no need to do this.
Data type
The root cause is that php is too easy to convert data types, hoho
Strongly typed languages generally return results with higher precision among a and B.