Daniel is beautiful, PHP novice asked a few face questions

Source: Internet
Author: User
Daniel Good, PHP novice ask a few face 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 is written in Php?a. By using AddType application/x-httpd-php ASPB. Specify all file names without any dot and extensionc. By using the. htaccess diretive in apeched. All of the above3. Explain the using Register Globals.




------Solution--------------------
1. Because 1)/is the division operator, not the divisible operator 2) (int) operator precedence is higher than/
SO (int) $a/(int) $b = 3/2 = 1.5

2. I choose D

3. Using the Register globals, the submitted variable can be used directly through the $ variable name.
However, there is a security problem, it is recommended not to use register Globals.
------Solution--------------------
(int) Acting on a variable, not an entire expression
(int) ($a/$b); So the result is 1.


2 In fact, these measures are not enough, it is better to recompile Apache, rewrite the Web server output header, hide the development language is PHP information

3 is a very deprecated feature.
------Solution--------------------
Upstairs two people
in C (int) A/(int) b but equal to 1 OH
This problem is from here.
The test center is the automatic transformation of the data type, and the result of dividing two integers is the floating-point number.
------Solution--------------------
discuss
Upstairs two people
in C (int) A/(int) b but equal to 1 OH
This problem is from here.
The test center is the automatic transformation of the data type, and the result of dividing two integers is the floating-point number.

------Solution--------------------
Explore

2 In fact, these measures are not enough, it is better to recompile Apache, rewrite the Web server output header, hide the development language is PHP information


------Solution--------------------
It's like talking about a place where there's no point. Or there's no need to do that.


Data type
The source is still the PHP conversion data type is too easy, HoHo

Strong type of language, usually in a, b, higher precision as a result of the return
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.