September 2016
Intermediate to advanced
1091 pages
21h 41m
English
PHP 7 also introduced some other new features with small changes, such as new syntax for array constants, multiple default cases in switch statement, options array in session_start, and so on. Let's have a look at these too.
Starting with PHP 5.6, constant arrays can be initialized using the const keyword, as follows:
const STORES = ['en', 'fr', 'ar'];
Now, starting with PHP 7, constant arrays can be initialized using the define function, as follows:
define('STORES', ['en', 'fr', 'ar']);Prior to PHP 7, multiple default cases in a switch statement were allowed. Check out the following example:
switch(true) { default: echo 'I am first one'; break; default: ...Read now
Unlock full access