PHP 8 es la versión que trajo más ventanas y sintaxis sencilla al lenguaje de programación PHP
Con PHP 8, la sintaxis de PHP se volvió más sencilla
PHP 7
htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
PHP 8
htmlspecialchars($string, double_encode: false);
PHP 7
switch (8.0) {
case '8.0':
$result = "Oh no!";
break;
case 8.0:
$result = "This is what I expected";
break;
}
echo $result;
//> Oh no!
PHP 8
echo match (8.0) {
'8.0' => "Oh no!",
8.0 => "This is what I expected",
};
//> This is what I expected
Lea más en Documentación oficial de PHP 8