Live data from Hacker News

PHP 8

php.net

51–60 of 273 posts

Re: PHP 8

#51

Php was my first language I learned 15 years ago. On that way I really started to hate it because of all it's quirks. Many of those have been fixed and nowadays I really enjoy it again and it's my goto language for any web project. It really hits a pragmatic sweetspot. It's really easy to deploy and frameworks like symfony give you all the power like rails but without the magic.

Same here, I started at the same time also with PHP.

But I never found back to PHP after switching to JavaScript in 2011. If something new comes out it usually runs JS.

Re: PHP 8

#52
post #41
post #37

Out of curiosity, why match expressions became popular for non functional languages? Without pattern matching on datatypes via cons expression (x::xs matching) it is just another kind of switch or if/else. Why do people promote this? here a nice comment on this topic: https://ocaml.org/learn/tutorials/data_types_and_matching.ht... "So one Really Cool Feature of functional languages is the ability to break apart data…

It simplifies the expression of if/then/elsif/elsif/else, even if it's not total. Why not steal it?

but why all of a sudden languages started to add this? Maybe the function itself needs to be simplified, maybe there is a design issue. i am failing to see how "if else" can be simplified via a synth sugar.

Re: PHP 8

#53
post #17
post #15

Earlier quoted context omitted.

No, I think WordPress being the most installed PHP application on the net warrants the special attention to it. https://w3techs.com/technologies/overview/content_management

Not sure I understand. I'm saying the PHP team didn't cede any deprecations to Wordpress this time. Meaning no special attention.

Sorry, I missunderstood what you were writing.

Yes, it doesn't look like they took special attention to WordPress when developing PHP 8.

Re: PHP 8

#54
post #52
post #41

Earlier quoted context omitted.

It simplifies the expression of if/then/elsif/elsif/else, even if it's not total. Why not steal it?

but why all of a sudden languages started to add this? Maybe the function itself needs to be simplified, maybe there is a design issue. i am failing to see how "if else" can be simplified via a synth sugar.

one benefit of match over switch is that it uses === and not == internally. So it does not suffer from type coercion problems.

Re: PHP 8

#55
post #52
post #41

Earlier quoted context omitted.

It simplifies the expression of if/then/elsif/elsif/else, even if it's not total. Why not steal it?

but why all of a sudden languages started to add this? Maybe the function itself needs to be simplified, maybe there is a design issue. i am failing to see how "if else" can be simplified via a synth sugar.

It's a switch statement that's an expression. That's a nice ergonomic improvement when you want to assign the result to a variable. Especially as it allows you to use a non-mutable variable whereas otherwise you'd have to make it mutable.

Re: PHP 8

#56

How should one start learning with PHP these days? My experience: hacked together a few PHP scripts over the years to notify me of a website change (5 minute cron job). Before that, I was a very good beginner with VB6 back in highschool. There are a couple of ambitious database-driven website projects I would like to create, but I don't know where to start. I like the KISS philosophy, and I think PHP and MySQL would…

Keep hacking, learn from your own mistakes, do this for 10 years. By the end of that time you should, for example, understand why we use Postgres instead of MySQL. :)

Re: PHP 8

#57
post #49

Earlier quoted context omitted.

Ruby is extreme flexible in terms of metaprogramming in rails uses that very much. And ruby is not statically typed. So if in rails you declare an active record model with belongs_to etc it's hard to keep track of what is really happening under the hood. In php you have almost no runtime metaprogramming so the things that could happen if you read a piece of code are reduced to a smaller set of options that are easier…

Ruby also raises an exception for a string coercion to an int when the string isn't an obvious int.

That's a local effect that can be avoided once you know the sematincs of the language. The issue with abused metaprogramming and monkey patching is that it results in global effects that are hard to track.

I would prefer to review a messy 50kloc php project over a messy 50kloc ruby project.

Re: PHP 8

#59
post #49

Earlier quoted context omitted.

Ruby also raises an exception for a string coercion to an int when the string isn't an obvious int.

That's a local effect that can be avoided once you know the sematincs of the language. The issue with abused metaprogramming and monkey patching is that it results in global effects that are hard to track. I would prefer to review a messy 50kloc php project over a messy 50kloc ruby project.

I was citing it as a good thing versus PHP's (and Perl's) "foo" == 0;// true behavior. I believe that still to be the right thing despite other issues Ruby has.

Re: PHP 8

#60

Php was my first language I learned 15 years ago. On that way I really started to hate it because of all it's quirks. Many of those have been fixed and nowadays I really enjoy it again and it's my goto language for any web project. It really hits a pragmatic sweetspot. It's really easy to deploy and frameworks like symfony give you all the power like rails but without the magic.

Same as many web languages, PHP's heyday has a reason as many toolkits at that time were far less powerful and complicated for even simple things. Perl+CGI + all the server setup for a simple dynamic page? It's just unimaginable to many today's developer.

I started off with PHP3 and have a very great and hated time with it till v5. PHP for sure is difficult to maintain and very painful to debug, but it's not my reason leaving it. It's because JS began to pick up and started to do many tasks that requires no server rendering. The server sides started to become just API server, which no longer generate html on the fly. It's much scalable and easy to maintain.

Time flies, now I see the release of PHP 8 and I realise I have ditched it for a decade. Do I miss you? No.

Post reply on HN