php

How to compile PHP-7.2 on CentOS

PHP

On November 30, 2017 the PHP development team released the PHP 7.2 version, this release added news features, here some of them:

  • New object type: Previously the object statement was used to convert one data type to another one e.g. an array to an sdtClass object and/or vice versa, PHP 7.2 introduces the object data type which can be used to specify the type of parameter and/or for the type of a function return.
  • Extension loading by name: Now it is not necessary to specify the file extension (.so for Unix, .dll for Windows) when loading an extension allowing greater portability in the php configuration file (php.ini).
  • Abstract method overriding: Now an abstract class that inherits from another abstract class can change/overwrite an abstract method of its parent class.

How to compile PHP-7.2 on CentOS Read More »

How to compile PHP 7.1 in Ubuntu 16.04

PHPOn December 1, 2016 the PHP development community released version 7.1, which added 12 new features , we mention some of them below:

Nullable types: Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, respectively.
Void functions: The void type functions should not return any value so they should use an empty return or omit it completely, I think that if you omit the return it gives more clarity to the code since it is more consistent with the definition of void, the NULL value is not a valid return value for void functions.
Symmetric array destructuring : The shorthand array syntax ([]) may now be used to destructure arrays for assignments (including within foreach).

How to compile PHP 7.1 in Ubuntu 16.04 Read More »

How to compile PHP-7.3 en Debian

On December 6, 2018 the PHP development community released version 7.3, which incorporated new features, here some of them:

  • More Flexible Heredoc and Nowdoc Syntax
  • Array Destructuring supports Reference Assignments
  • instanceof Operator accepts Literals
  • Trailing Commas are allowed in Calls
  • PCRE2 migration
  • Performance of the Multibyte String extension has been significantly improved

How to compile PHP-7.3 en Debian Read More »

How to compare objects in PHP

PHP offers a simple way to compare objects using the comparison (==) and identity (===) operators.

When using the comparison operator (==), object variables are compared in a simple manner: Two object instances are equal if they have the same attributes and values and are instances of the same class.

When using the identity operator (===), object variables are identical if and only if they refer to the same instance of the same class.

How to compare objects in PHP Read More »

How to Read XML files in PHP?

PHP

Over the past 4 years I have worked with many XML providers (interconnecting B2B applications) and some of these providers distribute big XML files, some of them have more than 2GB, as you may already suspect we should not dump 2GB of information into memory because PHP will generate a memory overflow fatal error and your application will not be able to recover by itself, so in this post I will explains how to solve this problem, using…

How to Read XML files in PHP? Read More »