What’s new in PHP 8

After a lot of to-ing and fro-ing as to when PHP 8 would be released, the developers have now announced that November 26th, 2020 is the date we’re waiting for.

The new version of PHP is expected to come with some new features that offer web developers many additional possibilities.

JIT Compiler, JSON extension always activated, Union Types, Static return type, WeakMap, Use ::class for objects, Stringable interface, Convert DateTime, Type annotations, Type errors…

Continue reading “What’s new in PHP 8”

PHP list() and Shorthand for Array Destructuring

PHP construct list() or its shorthand can be useful in many cases. It can be very useful to use it with PHP functions that returns arrays. Supun Kavinda have interesting article about.

Continue reading “PHP list() and Shorthand for Array Destructuring”

Install PHP 5.4 as standalone

PHP 5.4 is not packaged on most Linux distributions so it may be easiest to install it from source. On Debian-based Linux systems, you can use the following commands to install PHP 5.4 in such a way that it won’t effect any other versions of PHP that you may have installed: Continue reading “Install PHP 5.4 as standalone”

PHP sada ima ugrađeni veb server

Dočekali smo i PHP verziju 5.4.0.

New features in PHP

  • Improvements in memory management and performance.
  • Traits – A new mechanism for code reuse. It reduces the limitations of single inheritance.
  • Shortened Array syntax. Now use [...] instead of array(...) to create arrays.
  • Magic Quotes have been deprecated and entirely removed in PHP 5.4.0. Other language features that have been given the boot are safe mode, break / continue, and $var syntax.
  • WordPress, Drupal, and every other PHP based websites will run faster when they start using PHP 5.4.0.
  • Built-in Web server – PHP 5.4.0 now bundles its own web server which can be used for testing purpose. So you don’t need to install Apache web server to learn PHP/develop a website any more.
  • New version of Zend Framework.

 

PostgreSQL function call model for PHP

This article describes a simple class that can be used to call PostgreSQL functions. Using the class has a number of advantages:

  1. PostgreSQL functions can be called like they are PHP method functions with no special syntax.
  2. The statements are automatically prepared giving faster execution for multiple calls.
  3. No string escaping is needed for prepared statements.
  4. The prepared statements are automatically deallocated when the object is destructed.

NOTE: PostgreSQL prepared statement support requries PHP 5.1 or later. Continue reading “PostgreSQL function call model for PHP”