Live data from Hacker News

PHP 8.1.0

php.net

191–200 of 286 posts

Re: PHP 8.1.0

#191
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

> It started clumsy, true, but it became a solid and quite elegant way of doing things.

No. Just no. PHP will not be solid and elegant by evolution. It might have become an excellent tool for the area it's supposed to be used in, but the only way it could ever become elegant is if it had its python2=>python3 sort of moment. They would need to break it to fix it.

I don't think they'll do that, since I think they understand that it doesn't matter at all that the language sucks.

Re: PHP 8.1.0

#192
post #191
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

> It started clumsy, true, but it became a solid and quite elegant way of doing things. No. Just no. PHP will not be solid and elegant by evolution. It might have become an excellent tool for the area it's supposed to be used in, but the only way it could ever become elegant is if it had its python2=>python3 sort of moment. They would need to break it to fix it. I don't think they'll do that, since I think they under…

I don’t think breaking python2 did a lot to improve python 3.

Re: PHP 8.1.0

#193
post #191

Earlier quoted context omitted.

> It started clumsy, true, but it became a solid and quite elegant way of doing things. No. Just no. PHP will not be solid and elegant by evolution. It might have become an excellent tool for the area it's supposed to be used in, but the only way it could ever become elegant is if it had its python2=>python3 sort of moment. They would need to break it to fix it. I don't think they'll do that, since I think they under…

I don’t think breaking python2 did a lot to improve python 3.

That's probably because python2 wasn't that broken to begin with. But fixed character encodings was totally worth it. I think the only mistake they made was related to how long they kept supporting python2 -- but I'm sure there were good reasons for doing that.

Re: PHP 8.1.0

#194
post #134

Reading some comments here and it does confuse me Promises, async and await in javascript, coroutines and threads in kotlin, fibers in some language runtime (including this php 8.1 [0]), single process (nodejs), multi-process(php-fpm worker), single-thread, multi-thread, goroutines in go, multi-core coroutines Googling the definitions and x vs y situation helps a little, the main confusion to me is why some people wa…

Not all PHP is behind a web server. Think long running workers, queue consumers, daemons etc.

Re: PHP 8.1.0

#195
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

Not intended as a plug but you can even use php for network automation. I cobbled this together:

https://github.com/epiecs/phpmiko for connecting to devices and https://github.com/epiecs/mikodo for inventories and concurrency

The multi core coroutines comment is true but there are ways (to hack) around that.

The way I solved concurrency is just by forking and using sockets: https://github.com/epiecs/mikodo/blob/6bdcebe9fa7f44ffdedd82...

I use it at work atm does what it's supposed to. I also use Python as well but I wanted to know if it could be done in php :D

Re: PHP 8.1.0

#197
post #166

Earlier quoted context omitted.

Honest question: what are people using if not PHP? Node? Python? The 80% of us who aren’t FAANG and are writing CRUD apps. I’ve tried researching the pros/cons and all I get are low quality listicles. Nobody can tell me why PHP is “bad” or what Python does that PHP can’t. Inconsistent params are the only argument I’ve heard. Which my IDE solves. What about JavaScript splice vs slice. I look it up every time.

I write PHP for my job almost every day, and have for the past 4 years, and there's some truth to what you say: anything you can write in another language, you can also write in PHP. Personally, I can't stand writing PHP, because, sure, I can write secure, testable, safe code in any language, including PHP, but, how do I say this, PHP is the only language that feels actively hostile to my attempts to do so. The house…

> When I write Javascript or Python, I have complaints and issues, but I enjoy writing code. I think PHP, for many programmers, including myself, is just a hostile and unenjoyable experience.

Surely JS has at least an equal amount of foot-guns to PHP. I mean, at least PHP (to my knowledge) never had a meta-language written around it that compiles to PHP to make it safer.

Re: PHP 8.1.0

#198
post #67

Earlier quoted context omitted.

You can use a live reload tool, e.g. BrowserSync, to automatically refresh webpage after source file change. Put your browser on half of screen if you have big enough monitor, or even better - use dual screen setup. And if your IDE supports automatic saving, you are down to single step: "Edit file".

That's still much slower with JavaScript. We use both in php land.

In Javascript I don't compile or transpile Javascript during development so my src chagens are loadeded in chrome really fast. I suggest you to try snowpack or create your dev code test stream in fashion that do not require src code transformations.

Re: PHP 8.1.0

#199
post #166

Earlier quoted context omitted.

Honest question: what are people using if not PHP? Node? Python? The 80% of us who aren’t FAANG and are writing CRUD apps. I’ve tried researching the pros/cons and all I get are low quality listicles. Nobody can tell me why PHP is “bad” or what Python does that PHP can’t. Inconsistent params are the only argument I’ve heard. Which my IDE solves. What about JavaScript splice vs slice. I look it up every time.

I write PHP for my job almost every day, and have for the past 4 years, and there's some truth to what you say: anything you can write in another language, you can also write in PHP. Personally, I can't stand writing PHP, because, sure, I can write secure, testable, safe code in any language, including PHP, but, how do I say this, PHP is the only language that feels actively hostile to my attempts to do so. The house…

What footguns would that be?

Re: PHP 8.1.0

#200
I sometimes wish I'd never learnt C#. I love property accessors, as I consider properties to be a part of public API and in PHP, there's no nice way around it other than the boilerplate getters and setters.

Also I hope we'll get generics at some point. I know there are some issues with their implementation, but even non-runtime enforced generics would be better then relying on a docBlock annotation.

Enums are neat, though.

Post reply on HN