Comment by withinboredom

Comment by withinboredom 7 days ago

6 replies

> That's not a good sample size.

Like I said in the blog post, if I tell you the sky is blue and you don't believe me; run them yourself. FWIW, C# is faster now for that particular use case. Also, like I mentioned in a previous blog post ... which one would you rather maintain:

- https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorit... -- merge sort in C# 130 lines

- https://www.w3resource.com/php-exercises/searching-and-sorti... -- merge sort in PHP 60 lines

PHP is often far more concise than C#, and many other languages. I code more in Go than C# or PHP these days, but even Go has its limitations where it would be easier to express in PHP than Go. There are even certain classes of algorithms that are butt-ugly in Go but quite pretty in PHP.

PHP is still my favorite language, even though I hardly get to use it these days.

> PHP has a very specific usage which is web applications.

Originally, yes. But it outgrew that about 10 years or so ago. It's much more general purpose now.[1][2]

[1]: https://nativephp.com/ -- desktop applications in php

[2]: https://static-php.dev/ -- build self-contained, statically compiled clis written in php

phillipcarter 7 days ago

The C# to PHP comparison is not fair, as the link you gave for the C# code uses abstractions to support "arrays" that could also be backed by file storage. An equivalent translation of the PHP code is about 60 lines as well, before applying any code golfing (and including comments and whitespace).

neonsunset 7 days ago

You do realize that you are comparing two different implementations with different type systems that use different abstractions? Clearly you can't be serious. So, unless you are being intentionally misleading, this raises questions about the quality of "PHP solution" that is being worked on.

  • withinboredom 7 days ago

    I'm being serious in using it as an example of maintainability/expressiveness. The difference is deliberate, not accidental. I've written 15 PHP lines that would be hundreds of lines in C#, and I've written 15 lines of Go that would be hundreds of lines of PHP. Every language has its own strengths and weaknesses and levels of complexity. PHP fits into a sweet spot (IMHO) of low-levelness and high-levelness, but it is often not seriously considered due to its reputation in the 00's.

    • [removed] 7 days ago
      [deleted]