About significant changes in PHP 7.3

The following changes in PHP 7.3

– Flexible Heredoc syntax and Nowdoc syntax
– End comma can be used in function call JSON_THROW_ON_ERROR
– Can use reference passing with list () is_countable function
– array_key_first(), array_key_last()
– Argon2 Password Hash Enhancement

Flexible description of heredoc/nowdoc statement
You can now indent the end markers and the text you insert.

if(TRUE){
	print<<<EOS
	foo
	EOS;
}
&#91;/php&#93;

The indent of the string is determined relative to the end marker's position(indent). This allows you to easily control the number of spaces inserted etc. Note that mixing blanks and tabs in a string is not permitted, as it is controlled by indenting, and an error will occur.

<b>mbstring case conversion is enhanced</b>
The mbstring extension was originally developed to handle multi-byte strings, but it is actually used by many PHP programmers, including single-byte users, as extensions for string processing. As of PHP 7.3, upper and lower-case conversion mainly used in single-byte range is enhanced.

[php]
echo mb_strtoupper("Straße");

Allow commas to be inserted at the end of function arguments
Previously, in PHP 7.2 and earlier versions, although it was possible to write a comma at the end of the last element of the array, it was not possible to insert a comma at the end of function arguments. For example, when creating a function definition automatically by a script, putting a comma at the end may make writing code easier. In such cases, new features are useful.

$a = [1,2];
$b = [3,4];
$c = array_merge($a,$b,[5,6],);

is_countable(), array_key_*() function added
As of PHP 7.3, the is_countable() function has been added to check for countable functions. It can be used for purposes such as checking the functions that can be specified in the count() function.

if(is_countable($foo)){
	//$fooはカウント可
}

$a = ['one'=>'First','two'=>'Second','three'=>'Thred'];
echo array_key_first($a); // one
echo array_key_last($a); // three

Support for Same-site Cookie
A PHP session supports the Same-site Cookie(suggested as RFC 6265) that is said to be effective for cross-site request forgery(CSRF) protection as a security related function imrovement. When the SameSite attribute is specified, corss-site requests are limited and supported by major we browsers such as Google Chrome.