Suhrit Dutta

Saturday, 10 October 2015

PHP7 Features

1. Scalar type declarations
2. Return type declarations
3. Null coalesce operator
4. Spaceship operator
5. Constant arrays using define()
6. Anonymous classes
7. Unicode codepoint escape syntax
8. Closure::call() 9. Filtered unserialize()
10. IntlChar
11. Expectations
12. Group use declarations
13. Generator Return Expressions
14. Generator delegation
15. Integer division with intdiv()
16. preg_replace_callback_array()
17. CSPRNG Functions
18. list() can always unpack objects implementing ArrayAccess
--------------------------------------------------------------------------------------------------------
 1. Scalar type declarations

<?php// Coercive modefunction sumOfInts(int ...$ints)
{
    return 
array_sum($ints);
}
var_dump(sumOfInts(2'3'4.1));
The above example will output:
int(9)
 

0 comments:

Post a Comment