
Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster - ashitlerferad
https://www.phoronix.com/scan.php?page=news_item&px=PHP-7.2-Beta-1
======
esistgut
I would gladly exchange some speed for built in annotations. Writing code in
comments annoys me beyond measure.

------
abbiya
Best thing left out of php is concurrency.

------
cutler
On my 4-year-old Macbook Pro PHP 7.1 parses a 19Mb log file with the regex
"\b\w{15}\b" 5 times faster than Python and Ruby. It's even 3 times faster
than Perl which is hard to believe given Perl's insanely fast startup time.

~~~
nitely
Regex engine for all of those languages are coded in C, so that's probably not
a good benchmark. That said CPython and Ruby MRI are slower than PHP5, so yeah
PHP7 should be even faster.

------
vesak
Is there a PHP modding squad in Hacker News? Legitimate, non-offensive
anecdotes are getting downvoted in this thread while all positive comments are
being upvoted.

I think I've seen such a trend rising in the past few years, but I wasn't
sure: every thread covering PHP in some way gathered a crowd that defended
"how PHP is much better since 5.x" or referred to PHP being hated by people
without any good reason.

And yes. This very comment got downvoted to 0 in less than a minute from its
submission.

~~~
Yokohiii
tl;dr PHP has an identity crisis

PHP folks are a perfect case of the blub paradox and they are sadly always
looking up. PHP isn't treated with the respect it deserves. PHP powers large
parts of the internet, from tiny to huge projects. But there isn't even an
attempt to understand what it made/make work so well. PHP is quite different
from other languages but instead of curiosity from the competitors, there is
just bad reputation and ignorance. The community and language itself
constantly leans and evolves towards other languages. Ruby, Java, Javascript
and whatever. The shortcomings in contrast to other languages are often
drawing much attention in the community and in my opinion is overshadowing
PHP's strengthes. Much of the recent changes in PHP have been a kind of
fanservice to appeal the users of other languages. While this isn't
particularly a wrong strategy to stay around, it caused an addiction to be
more similar to the competitors. PHP lost it's identity and got unknowingly
angry about it.

This is just my opinion and there are some wrongs here, but thats how I would
currently explain the sub par PHP community behaviour.

~~~
concede_pluto
$x == $y should guarantee that $a[$x] == $a[$y]. In PHP, it doesn't. That's
not different, that's just broken, and the language design makes dozens of
elementary mistakes like that where getting it right wouldn't have sacrificed
the only strength (streamlined deployable server integration) in any way.

------
jaequery
it's really astonishing to see PHP still alive and kicking, despite all the
backlashes it has received over the years. whatever it is they are doing, they
must be doing something right.

~~~
vatotemking
Long time PHP dev here. Note: These are my personal observation and opinion.

The usage you see are mostly from people already invested in PHP. However, I'm
starting to see fewer new PHP devs. Some of the talented devs I know of have
migrated to other "cool" languages. There are fewer PHP jobs than they use to
be. I also observed less activity in PHP related subreddits. Its position as
the #1 web server language has already been taken over by nodejs, and the
remaining chunk eaten by Go, Python, C# (as ms tech goes open-source) and
other languages. I dont see PHP going away anytime soon, but I dont see it
gaining more users over time.

~~~
WA
> _Its position as the #1 web server language has already been taken over by
> nodejs_

How so? Because when I put a PHP script on a server with "<?php echo 'Hello
world' . date('Y' time()); ?>" that is a one-liner and I'm sure it'll work for
the next 20 years.

With nodejs, I have to implement the whole webserver and then my web app is
also a server, even if it's "only" 20 lines of code and I need other tools to
make sure that this server never crashes or automatically reboots and all that
stuff.

Imho, the main benefit of PHP is: You can write a script today and because the
language is mature, it doesn't change all the time and you can be quite
confident that it'll keep running for another decade.

~~~
mmcnl
With PHP you also need to implement a webserver (Apache), so you're one-liner
is also actually not a one-liner at all.

Also, pick the right tool for the right job. Who writes code these days that
silently sit still for a decade? Hardly anyone. And even if you do, I don't
think Python or Node will suddenly stop working (as you're implying).

~~~
tyingq
>With PHP you also need to implement a webserver (Apache), so you're one-liner
is also actually not a one-liner at all

With the "https everywhere" movement, the same is practically true for node.
You will likely be configuring some outside proxy/webserver.

~~~
vatotemking
FYI you can enable https without the need for an external webserver

------
nkkollaw
I don't think PHP's main problem is speed. It's generally used for websites,
and a few milliseconds aren't going to make a difference when pages are so
bloated by JavaScript libraries to often be 5-10MB.

PHP's problem IMHO is that I wouldn't be able to use it if it wasn't for
autocomplete: inconsistent function names, inconsistent parameter order.

The ecosystem is fine, there's Composer, PSR, Laravel. The problem is PHP's
legacy.

I wish someone created a PHP class one could use to namespace sane function
names and parameter order:

    
    
        \PHP\html_entities()
        \PHP\url_encode()
    

EDIT:

...and here it is:
[https://github.com/nkkollaw/php](https://github.com/nkkollaw/php), discussion
here:
[https://news.ycombinator.com/item?id=14885226](https://news.ycombinator.com/item?id=14885226).

Pull requests welcome :-)

~~~
ransom1538
Really?

So the main issue with php is a few functions have inconsistent parameter
order? Ignore the massive speed improvements, composer package manager system
or huge community. Good companies use php. I haven't met someone at facebook
that can't code it. (please spare me the HHVM comment or how your intern
friend does haskell in the basement).

Have you read about python 2 vs 3? Have you actually seen _real_ programming
language issues? Or tried to scale rails? Or worked on deploying java with 30
other people? Tracked a memory leak in c++? Been thrown into callback hell of
node? Have you tried to get stackoverflow answers while developing in MEAN.

IMHO people are just justifying their own stack (while secretly suffering with
python - a 26 year old programming language) [1][2]. In reality they know php
can do anything web / probably in less lines, portable, with easy to find
information, with a strong community, in less time, faster. I will let
everyone get back to figuring out what the difference between urllib and
urllib2 is in python.

[1][https://wiki.python.org/moin/Python2orPython3](https://wiki.python.org/moin/Python2orPython3)
[2][https://stackoverflow.com/questions/2018026/what-are-the-
dif...](https://stackoverflow.com/questions/2018026/what-are-the-differences-
between-the-urllib-urllib2-and-requests-module)

PS. Also, wtf does javascript librarys have to do with php.

~~~
vrodic
Do you have a public example that illustrates how PHP/Hack code in Facebook
looks like?

My problem with PHP is that most of modern frameworks seem to take a lot from
Java, and people have started to use type hinting whenever they can, so the
code looks like (uglier) Java, but without advantages of performance (being
made worse by having to setup everything on every request) or compile time
type safety.

~~~
jjirsa
1) php doesn't have to setup everything on every request - opcode caches,
process pooling et al exist

2) the benefit of php over java is that php is going to run everywhere with no
effort, and running that same java based website/service is going to start
with some doc on installing tomcat or similar, which will devolve into chaos
as you start working with ssl certs or shared servers

~~~
cagataygurturk
Bootstrapping a project with Spring Boot is 10x easier than dealing with some
modern PHP framework's setup and nginx stuff.

~~~
jjirsa
Flat disagree. The php framework is going to run on every shared host in the
world, and sprint boot isn't. I'm not saying PHP is better, I write java all
day every day, but if I had to build a website for a random friend or family
member, I'm writing it in PHP, because I know their hosting will run it.

------
rubyn00bie
Honest, sincere, question here:

How is programming in PHP these days? I haven't used the language since
4.x-5.2 or so. I wrote it off completely when Hack and HHVM came out due to
the nuances between it and PHP proper (not to say either is bad, it was just
another barrier, and set of choices I didn't care to deal with). I typically
write Ruby, Elixir, and some JVM based languages these days. Any new features
or language changes that make it more pleasant or any good use cases compared
to my usual languages? I will add using it anywhere, while a valid use case,
isn't something particularly attractive to me.

Edit: just wanted to say thanks for all the good comments posted so far!

~~~
jchw
PHP7 has improved life when dealing with legacy systems, but I think all in
all you're better off not building new stuff in it. There are almost always
better tools for the job than PHP, like Django, Rails, Go's net/http, etc.
depending on the kind of thing you're writing.

~~~
icelancer
>There are almost always better tools for the job than PHP, like Django,
Rails, Go's net/http, etc. depending on the kind of thing you're writing.

Except for the time when you are 10 times more proficient in PHP but none of
those languages. Then no, none of those languages are better for the job.

~~~
deevus
That sounds more like all you know how to use is a hammer, so everything is a
nail.

~~~
jjeaff
More like, all you need is a Swiss army knife, and there are dozens of
different Swiss army knives that can all get the job done. So use the one you
are most familiar with.

