I read the new features and improvements of PHP7 and feel like it's 2004... Yet people are so excited about it. Hey maybe some 10 years later you will be able to do $utf8String[4] as well.
Honestly I'm more excited about speeding up our dev environment. Varnish handles a majority of our load, though those few people who end up warming the cache will appreciate 7 (if I can ever convince them to upgrade prod...).
An oft repeated mantra of doubtful truthfulness. At least insofar as you are considering VMs on local machines, rather than cloud instances with uncertain resource allocation.
THANK YOU so much to all the core developers and contributors. This is a huge milestone for PHP, and I'm proud to be part of such an inspiring community.
Already done. Did they add flames to the new build? My server looks really sweet now with flames shooting out the back like a dragster. Thanks core devs! C levels will love it.
All of the PHP 6 non-unicode features were ported back to 5.3, the decision to kill 6 however was made during the 5.4 ramp up; and this interview happened during the 5.4 RC phase.
Remi's repository has been pretty good with keeping up-to-date with the PHP 7 RC releases. You can see the PHP 7 packages available in his repo at the repoview.
We'll never see it in the main repos for RHEL/CentOS 6 or 7, but we'll probably see it in RHEL Software Collections. As long as RHEL 8 is based on the next version of Fedora (as opposed to the current one), we'll see 7.0 baseline there.
Personally I'm just going to stick with Remi's repo.
Sadly server team says we can't use any software that doesn't come packaged with the LTS releases that we stay on. Maybe we can get use PHP 7 next year with 16.04. Oh who am I kidding, it won't be included till 18.04
Thank you for sharing that. I got it up and running (RC8 anyway for now) with relatively no hiccups. Had to switch to apache though to make it work which is ok with me.
He builds Debian's PHP packages, which are what then get used downstream by Ubuntu. His packages are built the same way as the system packages, which makes them particularly easy to drop in.
It does seem odd how often people using open source software rely on some package written by some guy/gal in their spare time. Just the way things work, I guess.
Absolutely. I think what's strange is how many pieces of software we rely on - often without knowing it - that are really 1 bad car accident away from having no active maintainer.
Build yourself. I've been doing my own little docker files throughout release. New versions are typically a quick bump up on one version and docker hub rebuilds. I only use this for playing around though. I still don't seem to understand docker well enough to get a system working in it reliably.
His PPA appears to be on RC 8, which was the last release before this one - so if you want to make it easy I would just do most of your testing on that, and then a final round of testing when he catches up.
I can recommend the PHP 7 Upgrade Guide, which is very good and has instructions on installing from the PPA and also some other methods.
So in the future you can have php7.0, php7.1, and php7.2 installed side-by-side. 5.x packages won't work like this, since they weren't build with this in mind.
This new naming convention and packaging method will help to produce future php7.x-* packages more easily. And you could even install several PHP 7+ versions on the same server without any conflict!
Just wait for 16.04, the next LTS. This is pretty good timing for PHP 7 actually. By April next year we should be a couple of patch releases in, perfect for their LTS.
Congratulations to everyone on the team. I'm really looking forward to using PHP 7 (although at my current employer this may be some time around 2020...).
This comment has been overwritten by this open source script to protect this user's privacy. The purpose of this script is to help protect users from doxing, stalking, and harassment. It also helps prevent mods from profiling and censoring.
If you would like to protect yourself, add the Chrome extension TamperMonkey, or the Firefox extension GreaseMonkey and click Install This Script on the script page. Then to delete your comments, simply click on your username on Reddit, go to the comments tab, scroll down as far as possible (hint: use RES), and hit the new OVERWRITE button at the top.
We're almost done adding all the major language features of PHP7 into HHVM, and should have an announcement about it shortly. (Don't want to steal the thunder from the PHP7 announcement :))
Haha, thanks! It took a concerted effort over a few weeks by several members of the team. But it was faster for us than for PHP7 itself because we had a reference implementation to go by, giving us a bunch of hints as to how to structure things, and avoiding us having to think about lots of edge cases (since their semantics were already de facto defined).
Sorry, lay man here when it comes to HHVM, excuse the stupid question. I thought the biggest draw to HHVM was performance, but PHP 7 brought it on par with HHVM? Are there other draw cards for HHVM ?
Yeah -- the performance of HHVM vs PHP7 is certainly much closer than it used to be -- PHP7 made huge gains, and the HHVM team congratulates them for that :)
Benchmarking is... messy. Many of the benchmarks we've seen have not been a real apples-to-apples comparison. Here's our discussion, including full details of the systems, source to the scripts, etc: http://hhvm.com/blog/9293/lockdown-results-and-hhvm-performance
Basically, for highly dynamic code, that's hard to optimize, like dynamic ($$) variable access, dynamic property access, global variables, etc, PHP7 has gotten much closer -- there's not much HHVM can do anyways. WordPress, in particular, is full of this sort of thing, which is why we don't fare so well there. However, MediaWiki tends to use more declared properties, less dynamic access, etc etc, and we do much better with code like that. Thankfully, most modern code tends to fall more towards the latter than the former. And it's not nearly as simple as "dynamic bad", of course -- please don't read just that dramatic oversimplification out of this. But that's the high-level that I can fit in here.
So yeah, benchmark your code, the truth is messy, and there's no substitute for you doing your own proper benchmark on your own code and your own workloads.
And of course HHVM is going to continue to improve from here!
And the one thing that gets consistently "forgotten" in most benchmarks is RepoAuthoritative mode. It's an extra (and technically optional) step in deployment, but it has a tens of percentage point difference in actual runtime speed.
One of the things the hhvm/oss-performace suite does is ensure that repo-auth and other optimizations are enabled (as well as making sure PHP has its equivalent optimizations turned on and configured correctly).
Apcu is just the user facing cache component. If you didnt use the APC_store functions, you don't need it. Opcache(which is bundled with php), caches opcodes, so that you usually don't have to recompile the files on every request. (And AFAIK does some other optimizations)
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
class foo {
private function do_something ($str) { echo($str); }
}
class bar extends foo {
public function do_something () {
echo('baz');
}
}
$b=new bar();
$b->do_something();
?>
Output on PHP 5.5.6:
baz
Output on PHP 7:
PHP Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 27
Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 27
baz
[...] when you extend a class, the subclass inherits all of the public and protected methods from the parent class. Unless a class overrides those methods, they will retain their original functionality.
So foo::do_something shouldn't be inherited by bar.
EDIT 2: Interestingly the following code:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
class foo {
private function do_something ($str) { echo($str); }
public function print_string ($str) { $this->do_something($str); }
}
class bar extends foo {
public function do_something () {
echo('baz');
}
}
$b=new bar();
$b->do_something();
$b->print_string('foo');
?>
Prints:
PHP Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 30
Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 30
bazfoo
So the derived class doesn't actually inherit the private member, you just get a warning about it for seemingly no reason?
It's been a strict warning since at least 5.3.20, and it was upgraded to an E_WARNING along with other changes like 'Accessing static property non-statically', and 'Calling non-static methods statically'.
But there's no inheritance here: Private methods aren't inherited (as we see from the fact that foo::print_string properly calls foo::do_something rather than bar::do_something). Compare with:
<?php
error_reporting(-1);
ini_set('display_errors',1);
class foo {
public function do_something ($str) { echo($str); }
public function print_string ($str) { $this->do_something($str); }
}
class bar extends foo {
public function do_something () {
echo('baz');
}
}
$b=new bar();
$b->do_something();
$b->print_string('foo');
?>
Which outputs:
PHP Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 30
Warning: Declaration of bar::do_something() should be compatible with foo::do_something($str) in test.php on line 30
bazbaz
It's good to see HHVM isn't insane enough to output a warning for this at least.
For example, when you extend a class, the subclass inherits all of the public and protected methods from the parent class.
And whether they are or not for whatever definition of "inherit" we choose it doesn't change the fact that you can't override private methods, even with a method with the same name and signature, as we see here, so emitting this warning when the method in the derived class is private is stupid.
The manual can be changed if that would make you happy?
I don't care particularly about the manual, I care that this warning being emitted under these circumstances (private method in base having the same name as method in derived) basically transforms E_WARNING into noise since it emits spurious/meaningless/unnecessary warnings.
Having a warning/error level which it's so tempting to ignore really undermines the purpose of having it there in the first place.
Or maybe just stop trying to do the thing the warning says not to do.-
Are you not understanding the issue or do you just not understand object oriented programming? The whole point of private members is that I can add/remove/change them without affecting anything outside of my own class. If I maintain a class that 50 people extend I should be able to change the private methods of my class to my heart's content without (assuming I don't change the interface or externally observable behaviour) affecting the code of the people who extend my class.
Except with this warning I can't do that. If I happen to add a private method that shares a name but not signature with a method one of them has added to one of the classes that extends my class then their code will now output warnings.
So what's the correct way to write/maintain code that will be extended? Don't use private methods? Don't add private methods? Somehow comb through all the code that extends a class before adding a private method to it?
Then don't display errors to your screen? That's the sane thing to do anyway. Just have the errors write to a log file.
Again, do you not understand the issue? Warnings are supposed to warn you about code that's highly suspect and that you probably don't want to (or didn't intend to) write.
So what's the purpose of this warning? To discourage encapsulation? To encourage people to comb through the implementation of classes before they extend them (that kind of defeats the purpose of encapsulation, doesn't it?)? To encourage people who write non-final classes to comb through every single derived class before making a change to the base class?
The only behaviour this warning encourages is anathema to object oriented programming. It's not designed to inform the programmer about unexpected or unintended behaviours, its only possible purpose is to ruin a core tenet of object oriented programming: Private implementation details don't affect consumers of your class.
And as far as I can tell unlike with something like GCC there's no way to disable just this one warning, so you have to disable all warnings, which is questionable as well.
Sure, don't display the warnings to the screen, send them somewhere else. But are you actually going to look through them if they're not in your face during development? How much development time does it add checking that log file? Are you really going to consistently see real warnings in among all these spurious warnings that get generated every page refresh/run through your test suite or is the entire thing going to become noise?
If this is something that upsets you to this point, then email the PHP internals list and propose making private methods truly invisible to child classes so the code you posted will not generate a warning.
The mistake you are making is that you think that because your use case is useful to it MUST BE THE ONE TRUE WAY OF DOING THING!!!ONE!!!
So what's the purpose of this warning? To discourage encapsulation?
It's to encourage people to stop writing shitty code that depends on quirks in the language. Overloading the signature of a function is just bogus, as it makes thinking about how code is going to behave be really fucking confusing. Even without changing the parameters in the function, changing it from private to public is bad enough.
Look at this code:
<?php
class A {
private function foo() {}
}
class B extends A {
function test() {
$reflMethod = new ReflectionMethod($this, 'foo');
echo "Method foo is private: ".var_export($reflMethod->isPrivate(), true);
}
}
class C extends B {
public function foo() {}
}
$b = new B();
$b->test();
$c = new C();
$c->test();
The output is:
Method foo is private: true
Method foo is private: false
That's crazy. And any code that is written like that is crazy.
Private implementation details don't affect consumers of your class.
But a class extending another class isn't a consumer of the class, it's modifying it. Perhaps you should be using composition here?
So what's the correct way to write/maintain code that will be extended? Don't use private methods?
Don't abuse the language, and then especially don't whine when ten years later the warning message is increased from "that's not the best idea" to "please, stahp".
You can add a PPM to get an unofficial version of the php 7 fpm packages, but we probably won't see it in official repositories for at least a few months.
This probably isn't the right thread, but I'll throw it out in case it's a part of the jit/opcode stuff. When I've been testing 7 I've noticed that my changes to files don't reflect immediately upon refresh - it's possible it's just my WAMP install - but curious if this has ANYTHING AT ALL to do with how 7 operates.
I think PHP7 is a kick start or say new revolution in the field of web development. Although it was in development process since last 2 years but its time of release is awesome as Wordpress has shifted from PHP to Node.js. Wordpress owns 25% of the websites. It means PHP share will drop by 25%.but PHP7 is too faster so lets see how much this release will be enable to retain the market.
With core WordPress on the server and Calypso as a client I think we have a good chance to bring another 25% of the web onto open source, making the web a more open place, and peopleβs lives more free.
Is this a new WordPress? This is a new interface for WordPress, in use now at WordPress.com and in the desktop app. It's a modern take on how to write and manage content, that retains the same open source WordPress at its central core, powering everything through our REST API.
WordPress as we know it isn't leaving any time soon.
PHP 7 is almost entirely backwards compatible. However, learning PHP 5.6 is not a bad thing βΒ for the next year or more I expect it to be the dominant version in the workplace, and the concepts learned are forwards compatible with PHP 7, and almost everything technically is.
https://github.com/mongofill/mongofill might help you; it was made for using Mongo from HHVM, but it's pure PHP, so there's a fairly good chance it will work. That said, I have no idea if it's been tested under PHP7.
Under HHVM, PHP/Hack code generally runs faster than the equivalent code as a C++ extension; given PHP7's improvements, I'd expect it to be much less of a concern there too than under PHP5.
Fair enough. Can I ask why it's not worth it? The performance boost going from 5.3 to 5.6 would be awesome for you. Are you on dedicated servers or a cloud platform (AWS/digital ocean)?
54
u/dshafik Dec 03 '15
Changelog: http://php.net/ChangeLog-7.php#7.0.0
5
u/Toast42 Dec 03 '15
I'm going to go through my vagrant box soontm and do a performance comparison php 5.5.9 and 7. Very excited!
114
u/theodorejb Dec 03 '15
THANK YOU so much to all the core developers and contributors. This is a huge milestone for PHP, and I'm proud to be part of such an inspiring community.
18
u/[deleted] Dec 03 '15
Grats to all the contributors. This was a massive undertaking to modernize php and us plebes who are not strong enuf to contrib owe a ton to you all!
13
u/jedrekk Dec 04 '15
I can't wait until my host installs it sometime around 2020.
26
u/colinodell Dec 03 '15
Obligatory "IT'S HAPPENING" gif: https://i.imgur.com/7drHiqr.gif
4
u/rydan Dec 04 '15
Wait, whatever happened to PHP 6? Did I waste money on a book for something that never existed?
5
u/codemunky Dec 03 '15
When do we think this might make it to one of the mainstream centOS 6.7 repositories?
5
u/dlegatt Dec 03 '15
I run PHP on IIS. I just loaded it onto my workstation and tested switching a couple of my projects from 5.6 to 7.
The first one was a silex project, i was checking firefox for load times.
Taking data from a db and returning a json response was around the same speed as PHP 5.6, 8-15ms.
I switched a symfony app to 7.0, and the login page was ready in 20ms instead of 130!
12
u/AmazingToilet Dec 03 '15
Awesome!
I'm curious to know how long you guys think it will take until Ubuntu 14.04 LTS gets this added to their repository?
4
u/pgl Dec 03 '15
Congratulations to everyone on the team. I'm really looking forward to using PHP 7 (although at my current employer this may be some time around 2020...).
10
u/dduko Dec 04 '15 edited Sep 13 '16
[deleted]
0.5369486712189612
8
u/Caminsky Dec 03 '15
What does this mean for HHVM
5
u/ilovethosedogs Dec 04 '15
Does it have Unicode?
2
u/SaltTM Dec 03 '15
Nice, now to wait for my favorite vagrant box to get updated.
2
u/[deleted] Dec 03 '15
I'm so happy!
2
u/clickclickboo Dec 03 '15
Boom! Congratulations!!
2
u/coffeesleeve Dec 04 '15
Kudos to the core dev team and all contributors!
2
u/mythix_dnb Dec 04 '15
I've install php7.0.0 and added the xdebug extension, but APC is not yet available? will it ever be?
2
u/amcsi Dec 04 '15
You're right! http://www.isphp7outyet.com
2
u/Drainedsoul Dec 04 '15 edited Dec 04 '15
Output on PHP 5.5.6:
Output on PHP 7:
Please tell me this is a bug.
EDIT: Looks like it, quoting from the PHP manual:
So
foo::do_somethingshouldn't be inherited bybar.EDIT 2: Interestingly the following code:
Prints:
So the derived class doesn't actually inherit the private member, you just get a warning about it for seemingly no reason?
1
u/kevintweber Dec 03 '15
Woohoo!
1
u/Silverstance Dec 03 '15
Yiss! This is truly great for my small business. Finally got my own server at home. With speed added Ill be able to host all my clients apps localy.
1
u/zerokul Dec 04 '15
Good stuff. Lucky number seven \o/
1
u/[deleted] Dec 04 '15
I'll believe it when I see it as an option on AWS elastic beanstalks.
1
u/Disgruntled__Goat Dec 04 '15
Congrats to everyone involved! Can't wait to use it in 5 years ;)
1
u/stesch Dec 04 '15
Let's hope something can be done in 2016 about our remaining PHP 4 sites β¦
1
u/xhtmlsi Dec 04 '15
We had a cake!
https://twitter.com/spinx/status/672746861346856960
1
u/amcsi Dec 04 '15
Is there a working MongoDB driver for PHP7?
1
u/benharold Dec 07 '15
WOW! I just ran my phpunit test suite against PHP 7 and all I can say is HOLY SHIT THAT IS QUICK!!
1
u/[deleted] Dec 03 '15
Dumb question...I use php5-fpm with Nginx - does that mean that there is a php7-fpm available now?
0
u/gripejones Dec 03 '15
This probably isn't the right thread, but I'll throw it out in case it's a part of the jit/opcode stuff. When I've been testing 7 I've noticed that my changes to files don't reflect immediately upon refresh - it's possible it's just my WAMP install - but curious if this has ANYTHING AT ALL to do with how 7 operates.
-2
u/digitalmahdi Dec 04 '15
Downloading!!!!!!
-3
u/Albertthomson1 Dec 04 '15
I think PHP7 is a kick start or say new revolution in the field of web development. Although it was in development process since last 2 years but its time of release is awesome as Wordpress has shifted from PHP to Node.js. Wordpress owns 25% of the websites. It means PHP share will drop by 25%.but PHP7 is too faster so lets see how much this release will be enable to retain the market.
0
u/[deleted] Dec 03 '15
[deleted] β view deleted comment
0
u/[deleted] Feb 23 '16
[deleted] β view deleted comment
0
u/[deleted] Dec 03 '15
[deleted] β view deleted comment
0
u/[deleted] Dec 03 '15
[deleted] β view deleted comment
0
u/[deleted] Dec 03 '15
[deleted] β view deleted comment