1. Use the comma connection string instead of the period echo "AAA". BBB "echo" AAA "," BBB ";
2. String contains variable when using double quotation marks 3.require faster than Require_once4. Calculate the cycle length in advance
<?php$items = Array (1,2.3,4,5.6), $count = count ($items), for ($i =0; $i < $count; $i + +) {$x = 123* $i;}
5. Use the Foreache loop instead of the while live for loop (execution speed:foreache<while<for) 6. File access, using file_get_contents () to read the file. PHP has four ways to read data from files: Fread (),file_get_contents (), file (), and ReadFile (). fread (), file_get_contents () and ReadFile () return the data as strings, and file() returns the data in the file as an array. Only file_get_contents () caches files in memory for faster read and write operations, which is known as memory mapping.
PHP develops several tips for improving performance