zlacker

[parent] [thread] 17 comments
1. tiffan+(OP)[view] [source] 2022-12-08 13:18:28
What’s a feature that PHP is missing, that if it had it - would garner it more respect?

Note: I think PHP is way under appreciated.

replies(8): >>dncorn+n2 >>rob74+x2 >>cies+83 >>zmxz+N3 >>sebste+a5 >>Manuel+S9 >>tored+na >>naranh+pn
2. dncorn+n2[view] [source] 2022-12-08 13:36:04
>>tiffan+(OP)
Having an event loop that can freeze your whole application, is my guess.
replies(1): >>tiffan+53
3. rob74+x2[view] [source] 2022-12-08 13:36:44
>>tiffan+(OP)
Hmmm, how do I say this without being downvoted... it's not as much a feature that is missing, it's unfortunately the whole origin of PHP as a language that wasn't really carefully designed, but just kinda grew organically (famously Rasmus Lerdorf didn't intend it to be a general purpose programming language at all, but "just" a templating language). Despite the efforts since PHP 7 (also partly already PHP 5) to make it more "professional", it won't be possible to completely shake off this legacy. Don't get me wrong, I like PHP as a no-nonsense language in which you can get web dev tasks done quickly and effectively, and I would pick PHP over Node any time, but the inherited warts are undeniable and at least some of them are here to stay.
replies(1): >>paulry+w4
◧◩
4. tiffan+53[view] [source] [discussion] 2022-12-08 13:39:40
>>dncorn+n2
Isn’t a huge benefit of how PHP executes is that it’s stateless.
replies(1): >>cies+Id
5. cies+83[view] [source] 2022-12-08 13:40:01
>>tiffan+(OP)
I'd say you are probably down voted because you do not provide argument as to why it is under appreciated.

The thing is that PHP is (was) a good example of bad language design. It's original creator is (was) also known for its total disdain for "correct working software". The language and standard library even more show this quite clearly.

See reddit.com/r/lolphp for a community dedicated to bringing PHP's bad design pearls to the surface.

6. zmxz+N3[view] [source] 2022-12-08 13:43:18
>>tiffan+(OP)
1. Support for generic programming.

2. Officially supported runtime that exposes system event loop to userland (yes, we have swoole and roadrunner)

replies(1): >>tiffan+K4
◧◩
7. paulry+w4[view] [source] [discussion] 2022-12-08 13:47:10
>>rob74+x2
Which warts?
replies(1): >>oaiey+Oh
◧◩
8. tiffan+K4[view] [source] [discussion] 2022-12-08 13:48:21
>>zmxz+N3
Related to #2, doesn’t this then make PHP stateful - which some might argue is a negative.

EDIT: have you looked at ngx-php. It’s blazing fast and provides you that event loop.

https://github.com/rryqszq4/ngx-php

https://www.techempower.com/benchmarks/#section=data-r21

replies(1): >>zmxz+H5
9. sebste+a5[view] [source] 2022-12-08 13:55:38
>>tiffan+(OP)
Type hinting for arrays and all data structures

They'd gather back my respect when they get rid of all the moronic behavior they have in the functions of their global namespace

* Like sleep that returns 192 on windows but not on linux when you interrupt it

* hash_hmac that if you pass array to $data, php will generate a Warning, return a NULL and continue, I'll let you imagine how bad this is in the context of hmacs when null gets typecast to 0 later on

* etc

replies(1): >>zerocr+RX
◧◩◪
10. zmxz+H5[view] [source] [discussion] 2022-12-08 13:59:53
>>tiffan+K4
Stateful as in it would preserve objects/variables between requests (if served by the server that spins the runtime up)?

That's something up for debate. Personally, I'd like the shared-nothing approach but I'd like to have async capabilities to optimize I/O and a function that flushes the request and frees up resources for next request in queue.

edit: I haven't seen ngx_php, thanks for the link!

11. Manuel+S9[view] [source] 2022-12-08 14:26:07
>>tiffan+(OP)
Typed collections.
12. tored+na[view] [source] 2022-12-08 14:29:34
>>tiffan+(OP)

  * function autoloading
  * typedef 
  * templating hooks for escaping output and such
  * better phpdoc, e.g define class without creating class, nested structures. 
  * inner class 
  * modules (instead of namespaces)
◧◩◪
13. cies+Id[view] [source] [discussion] 2022-12-08 14:50:00
>>tiffan+53
In most languages you can choose your execution model. Stateless then is an option, a design choice.

If it's all your language does, I do not think it counts as a benefit. Not in my book at least.

replies(2): >>tiffan+Pe >>concep+Vq
◧◩◪◨
14. tiffan+Pe[view] [source] [discussion] 2022-12-08 14:57:51
>>cies+Id
Can you give an example of another language you can do this?

Note: PHP has Swoole, etc.

◧◩◪
15. oaiey+Oh[view] [source] [discussion] 2022-12-08 15:14:41
>>paulry+w4
That I start a code file with a special tag, that I have to be careful not accidently emitting e.g. white space (because it is a template engine ;)), that I am not accidently emitting the source code of my program because a tag was not closed, ...

Like the poster above: I totally support PHP ... it is good, it has surprisingly well aged in the recent years, and it perfectly has its place ... but it has warts. Nothing bad, nothing tooling could not compensate ... but there are warts because of its origin.

Other languages has warts too: Java has no real generics, Python has it when you do indenting wrong and let us not start on JavaScript or god forbid VisualBasic. As a C# fanboy, i have to rely on others to see warts there ;)

16. naranh+pn[view] [source] 2022-12-08 15:40:54
>>tiffan+(OP)
For me something to stand out in the current day and age. THE "killer" feature.

It has some nice things but for everything in PHP, there other languages that do it a lot better. And I don't think CGI is a killer feature in 2022, it doesn't matter anymore than any other implementation detail, and causes more problems than it solves.

◧◩◪◨
17. concep+Vq[view] [source] [discussion] 2022-12-08 15:54:03
>>cies+Id
most interpreted languages cannot without big overhead
◧◩
18. zerocr+RX[view] [source] [discussion] 2022-12-08 18:28:01
>>sebste+a5
The manual doesn't indicate the specific change (this is one area of weakness for the language), but hash_hmac already no longer does what you're talking about: passing a non-string there is a TypeError since 8.0.

Increased strictness in the types that can be passed to the built-in functions has been a general area of focus for the last several versions.

[go to top]