Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 18.04 - Install PHP 7.3

PHP

Steps

sudo add-apt-repository ppa:ondrej/php -y
sudo apt update && sudo apt install php7.3 -y

Key New Features

JSON Decode Update

You can now pass JSON_THROW_ON_ERROR to json_decode to have it throw an exception when json_decode fails, rather than have it return null. E.g.

try
{
    $orders = json_decode("dfdf", true, 512, JSON_THROW_ON_ERROR);
} 
catch (JsonException $ex) 
{
    die("There was an issue decoding that!");
}
Last updated: 19th February 2020
First published: 21st November 2019