Posts Tagged ‘PHP’
PHP 5.4
Comments Off on PHP 5.4
Here are some things you need to know about PHP 5.4.
1) Trait SupportImprovements to single inheritance for classes.
2) Array ImprovementsArray manipulation has improved by introduction of array de-referencing. This removes the need to define temporary variables. Code looks neater. Now you can do:
$food = explode(",", "pizzahut,burgerking,kfc,mcdonalds"); $food[3]; // mcdonalds echo explode(",", "pizzahut,burgerking,kfc,mcdonalds")[3]; //mcdonalds 3) $this support in Closures 4) Build-in CLI Web ServerA command line web-server is included in the php interpreter. This is invoked by: $ cd ~/public_html $ php –S localhost:8000 5) <?= support
The short_open_tag setting in php.ini allows for the use of <?= by default in PHP 5.4. Code looks neater. Example:
Previously we used: <?php echo $variable ?>
Now we can use: <?= $variable ?>
Read more