Live data from Hacker News

Things you should know about PHP 7

pages.zend.com

21–30 of 124 posts

Re: Things you should know about PHP 7

#21

Seeing this: > function add( ... ): float {} I think a much better choice would have been: > float function add( ... ) {} Or just: > float add( ... ) {} Since that's how it's done in other languages and people would feel at home with it.

I thought that was rather odd as well. Are there many languages using this form of return type specifier?

Re: Things you should know about PHP 7

#22
post #7
post #3

TL;DR: 1. Scheduled to come out in Q4 2015 2. operator, see https://wiki.php.net/rfc/combined-comparison-operator 3. Return Type Declarations & Scalar Type Hints 4. Speed improvements (25-70%) 5. Yep, speed improvements are for real. You're welcome.

So 1 is not a feature, 4 & 5 are the same thing (and maybe a consequence of 3) while 2 can be remplaced by a single function. Seems like the only new feature are type hints. Looks like Hack has been rebranded as PHP 7.

PHP7 is really just about the speed boost.

Re: Things you should know about PHP 7

#23

Heck, I'm kinda felling bad as a Pythonista. We're lagging badly speed wise. Sure, there's PyPy but it's not compatible with the mainstream C-Extensions so pretty much a no-go for most of my projects. Hopefully Piston will come to rescue in the future.

Well, maybe you should review your stack. Which C extensions are you missing? There are alternatives for the most part (barring GUI)

Re: Things you should know about PHP 7

#24
post #6
post #4

Earlier quoted context omitted.

> 1. Scheduled to come out in Q4 2015 ... and available on general cheap webhosting sometime around 2020. If we're lucky. Thank god our company slowly moved away from building small PHP websites that have to run on the most fucked up PHP installations from the before-time. Now it's PHP 5.6+ everywhere :-)

>... and available on general cheap webhosting sometime around 2020. If we're lucky. Shared Hosting needs to die off anyway.

Okay, sure, instead your new job is to play security and sysadmin for the DigitalOcean containers for all the small local business Wordpress sites for say $10 an hour.

Shared Hosting has many downsides, but it still fills an incredibly important niche for businesses for whom a web presence beyond a Facebook page is needed but real managed hosting is completely out of their price range.

Re: Things you should know about PHP 7

#25
post #16

Seeing this: > function add( ... ): float {} I think a much better choice would have been: > float function add( ... ) {} Or just: > float add( ... ) {} Since that's how it's done in other languages and people would feel at home with it.

Haxe uses the first syntax, as does AS3. So it's not like "other languages" are universally opposed to this order.

Rust also has this syntax if I remember correctly, for parsing reason

Re: Things you should know about PHP 7

#26

Seeing this: > function add( ... ): float {} I think a much better choice would have been: > float function add( ... ) {} Or just: > float add( ... ) {} Since that's how it's done in other languages and people would feel at home with it.

The idea is that the old php syntax "function foo ()" remains unchanged [1] so developers can keep searching for "function foo". Removing "function" as keyword is a different topic and is discussed in a separate php thread [2].

The thing you mention ("float function add(){}") keeps the option to search for "function add", but I am unsure why this is not taken into account in this proposal.

Anyhow, I am pretty happy this finally made it to the php language.

[1] https://wiki.php.net/rfc/return_types#position_of_type_decla...

[2] http://marc.info/?t=141235344900003&r=1&w=2

Re: Things you should know about PHP 7

#27
post #3

TL;DR: 1. Scheduled to come out in Q4 2015 2. operator, see https://wiki.php.net/rfc/combined-comparison-operator 3. Return Type Declarations & Scalar Type Hints 4. Speed improvements (25-70%) 5. Yep, speed improvements are for real. You're welcome.

Thank you. This website is completely useless on mobile.

Re: Things you should know about PHP 7

#29
post #16

Seeing this: > function add( ... ): float {} I think a much better choice would have been: > float function add( ... ) {} Or just: > float add( ... ) {} Since that's how it's done in other languages and people would feel at home with it.

Haxe uses the first syntax, as does AS3. So it's not like "other languages" are universally opposed to this order.

AFAICT both Haxe and AS3 consistently put types on the right, including argument declarations. Other languages consistently put it on the left. Most languages make a choice like that; PHP mixes things up a bit.

But then, it wouldn't be PHP if it was too consistent ;).

Re: Things you should know about PHP 7

#30

Seeing this: > function add( ... ): float {} I think a much better choice would have been: > float function add( ... ) {} Or just: > float add( ... ) {} Since that's how it's done in other languages and people would feel at home with it.

Go also does types different from C, and they have a nice page explaining the reasoning of their syntax here: http://blog.golang.org/gos-declaration-syntax
Post reply on HN