update php to 8 code example

Example 1: php 8

latest version of php.
see new features at https://php.watch/versions/8.0

Example 2: latest php version

<?php
$json = file_get_contents('https://www.php.net/releases/?json');

$releases = [];
if ($json) $releases = json_decode($json, true);

/**
 * Versions
Array
(
    [0] => 7
    [1] => 5
    [2] => 4
    [3] => 3
)
*/
$versions = array_keys($releases);

/** solution to: latest php version */
if (array_key_exists(max($versions), $releases)) {
  echo $releases[max($versions)]['version']; // as of Aug 2020.. 7.4.9
}

Tags:

Php Example