Skip to content

PHP 5.4

By glitchdata Team 1 min read

PHP_Elephant1PHP_Elephant1Here are some things you need to know about PHP 5.4.

1) Trait Support

Improvements to single inheritance for classes.

2) Array Improvements

Array 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 Server

A 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

More news

News 3 min read

Your Account Is Yours, and So Are the Numbers

A new Insights page reports your downloads, likes, progress and quiz results, with CSV exports of all of it. Alongside it: account settings, a forgotten-password link that actually exists, and a notification when an admin reviews your work.

News 2 min read

One Search Box, and a JSON API for Everything Public

Search now covers datasets, models, courses, guides and news from a single box. Everything a signed-out visitor can read is also available as JSON, with no key and nothing to sign up for — plus RSS feeds and a sitemap.

News 2 min read

Quizzes, Certificates and Reviews for Every Course

Lessons can now end with a quiz you have to pass to finish them, courses issue a shareable certificate when you reach the end, and the learners who took a course can say what it was worth.