How to use the default PHP to execute the phar package?

When developing an installation program recently, it was packaged as a phar package. One problem encountered was that the packaged phar package could not be executed without php. # normal operation php install.phar # Report an error ./install.phar Omit php to report an error when running: $ ./install.phar ./install.phar: line 1: ?php: No such file… Read more How to use the default PHP to execute the phar package?

How does PHP implement calculation formula processing in string format

In the development, we will encounter some needs to configure the calculation formula, for example We have configured a magnification and a calculation formula in the background, for example, the magnification is 3, the calculation formula is: %d*%d+100, which means a number multiplied by the magnification plus a supplementary value So how should we deal… Read more How does PHP implement calculation formula processing in string format

A few Tips to make PHP7 reach the highest performance

1. Opcache Remember to enable Zend Opcache, because PHP7 is faster than PHP-5.6 with Opcache enabled even if Opcache is not enabled, so some people have not enabled Opcache during the previous testing period. Enabling Opcache is very simple, add it to the php.ini configuration file : zend_extension=opcache.so opcache.enable=1 opcache.enable_cli=1″ 2. Use the new compiler… Read more A few Tips to make PHP7 reach the highest performance

Confusing strtotime

Suppose the code is executed on 2018-07-31, how can the output be 2018-07-01? date(“Y-m-d”,strtotime(“-1 month”)) Okay, although this question seems very confusing, but from the internal logic, it is actually “right”: Let’s simulate the processing logic for this kind of thing inside date: 1. First do -1 month, then the current is 07-31, and after… Read more Confusing strtotime

PHP_INT_MIN and -9223372036854775808

Is the output the same? If not, why? var_dump(PHP_INT_MIN); var_dump(-9223372036854775808); I think this kind of question is not suitable as a PHP interview question. But as an interesting point of knowledge, let me talk about this little problem today. We know that the table value range of 64-bit integers is -9223372036854775808 to 9223372036854775807. On 64-bit… Read more PHP_INT_MIN and -9223372036854775808

Web Cookie

What is a cookie A cookie is a small text file stored on the user’s computer by the browser Cookies are in plain text format and do not contain any executable code A web page or server tells the browser to store cookies in accordance with certain specifications, and sends this information to the server… Read more Web Cookie