Php, you may not know the "death" trap

Source: Internet
Author: User
Die (time () * 1000); what will be output? Well, you may say it outputs 1000 times the current timestamp. But you are wrong! It is not necessarily the correct output according to your expectation. In a 32-bit operating system, It outputs 1000 times the timestamp, but in a 64-bit operating system It outputs nothing. Why? Take a look at the manual: If the PHP version number is greater than or equal

Die (time () * 1000); what will be output? Well, you may say it outputs 1000 times the current timestamp. But you are wrong! It is not necessarily the correct output according to your expectation. In a 32-bit operating system, It outputs 1000 times the timestamp, but in a 64-bit operating system It outputs nothing. Why? Take a look at the manual: If the PHP version number is greater than or equal

die(time()*1000);

What will be output?

Well, you may say it outputs 1000 times the current timestamp.

But you are wrong! It does not necessarily output the correct value as expected.

In a 32-bit operating system, It outputs 1000 times the timestamp, but in a 64-bit operating system It outputs nothing.

Why? Take a look at the manual:

If PHP version is later than or equal to 4.2.0, this parameter is not output when the die parameter is an integer.

Well, in a 32-bit operating system, time () * 1000 has exceeded the integer length, and php will convert it to floating point output.

The following is the extension information:

Die is an alias of exit. exit is not a real function, but a statement (a language construct) Like echo ). As mentioned above, if the parameter of a function is an integer, it will not be output in the book. Why? Exit indicates that the script exits. The integer parameter indicates the exit status. The value ranges from 0 to 255. 0 indicates normal exit, non-zero mark is error code.

[php]
//exit program normally
exit;
exit();
exit(0);

//exit with an error code
exit(1);
exit(0376); //octal
[/php]

Http://hipop.co.cc/archives/105

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.