Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Whats your thoughts on PHP 7?

Featured Replies

So out of curiosity what are your thoughts on PHP 7? Personally i find it a big upgrade from previous versions some of the newer features i like is...

 

Short hand version for writing arrays(PHP 5.4)

 

Well this is not to much shorter but it does look neater

 

instead of writing arrays like this...

$colors = array("color1","color2","color3");

you can write arrays like this...

$colors = ["color1","color2","color3"];

As noted below shorthand arrays actually came out in PHP 5.4 . My Mistake :)

 

Type Hints

 

You can now apply data type hints to parameters of functions/class methods

function hello(string $msg){
return $msg;
}

echo hello("Hello World");

you can also turn on strict type mode in order to hold you accountable by displaying a fatal error if you pass a data type other then the type specified.

declare(strict_types=1);

that line must be the first line on the page. And it has to go on each page. There is no way to make it global

 

The ?? Operator

 

Normally you would do this ...

$action = (isset($_GET['action')) ? $_GET['action'] : "no_action_set";

Now you can do a short hand version using ??

$action = $_GET['action'] ?? "no_action_set";

Constant Arrays

 

You can now define array constants using define instead of just const

define("COLORS",
["red","blue","orange"]
);

SPEED

 

PHP 7 is said to be about 3x faster than PHP 5.6

Edited by webdesigner93

I don't think the array shorthand is PHP7, I've definitely used it on older versions. I like the strict typing stuff they've added though.

I haven't gotten the chance to check out many of the new features, but I find anonymous classes to be a cool new feature. I'm not entirely sure why it hasn't been added yet, though.

  • Author

I haven't gotten the chance to check out many of the new features, but I find anonymous classes to be a cool new feature. I'm not entirely sure why it hasn't been added yet, though.

Anonymous classes are already added haven't fooled around with them yet tho

Anonymous classes are already added haven't fooled around with them yet tho

Yeah, I didn't phrase my sentence properly. I meant to say: I wonder why it hasn't been added until now. :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.