Syntax

<!DOCTYPE html> <html> <head> <title>PHP “Hello, World!” program</title> </head> <body> <?php echo ‘<p>Hello, World!</p>’; ?> </body> </html>

Functions

function myAge(int $birthYear): string { // calculate the age by subtracting the birth year from the current year. $yearsOld = date(‘Y’) – $birthYear; // return the age in a descriptive string. return $yearsOld . ‘ year’ . ($yearsOld != 1 ? ‘s’:”); } echo ‘I am currently ‘ . myAge(1995) . ‘ old.’;

PHP 6 and Unicode

PHP received mixed reviews due to lacking native Unicode support at the core language level.[39][40] In 2005, a project headed by Andrei Zmievski was initiated to bring native Unicode support throughout PHP, by embedding the International Components for Unicode (ICU) library, and representing text strings as UTF-16 internally.[41] Since this would cause major changes both […]

Just-in-time compilation

PHP 8’s JIT compiler can provide substantial performance improvements for some use cases. PHP developer Nikita Popov has stated that the performance improvements for most websites will be less substantial than the upgrade from PHP 5 to PHP 7. Performance improvements due to the addition of the JIT compiler are expected to be more substantial […]

PHP 5

On 1 July 2004, PHP 5 was released powered by the new Zend Engine II. PHP 5 included new features such as improved support for object-oriented programming, the PHP Data Objects (PDO) extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. In 2008, PHP 5 became the only stable […]