Hey if you don't like PHP please don't use it. I 'd hate to bring the culture of tiny packages, fake compilers, transpilers and weekly trends to PHP. Personally I use php because it works well and fast and still supports my 10 year old websites, not because it's cool.
Php change from 4.x to 5.x broke my web sites and I still don't trust php after that. I guess they might do it again from 7.x to 8.x, we'll see. If having the same code working for a long time is the most important for you then you should probably use java or .net. Maybe c++ also but that is not as popular for building web apps.
PHP is worth learning and using
411–420 of 468 posts
Re: PHP is worth learning and using
#412Earlier quoted context omitted.
Frankly my reasons for using it boil down to: 1. WordPress uses it 2. PHP is far less terrible than I remember (having used it in very early days) I manage a WP (woocommerce) site for a small business. It's not my day job, it needs to be simple. Most of the "day job" is handled by content management users. I have written a fair amount of plugins though to enable custom functionality and the process is perfectly fine.…
I would not recommend anyone to use WordPress in 2021, though. WordPress maybe simple to setup, it's part of what gave PHP its bad reputation.
I honestly always wonder: as opposed to what? Let's take my simple requirement, a small business ecommerce store that's not going to look like trash and where non technical users can make pages, edit descriptions, etc.
I can do: WordPress, Magento, or I can pay a SaS provider. Essentially both do it yourself approaches are PHP and Magento has really sabotaged itself with the complicated migration. SaS means higher costs and if I want custom functionality (and yes, the business needs it), it ranges from impossible to possible but a headache.
So here is a business that is now online for a minimal cost for two years, allowing great flexibility for me, while allowing completely non technical users to get crap done.
Re: PHP is worth learning and using
#413| php is fast. https://benchmarksgame-team.pages.debian.net/benchmarksgame/... it's faster than python, but my grandma is too and she died in 1993. However, function calls are extremely slow. If you would bench something like a naieve fibonacci implementation (or ackermann's function) you would be surprised.
I have stopped trusting the aforementioned link because they play dirty games with benchmarks, most of the times. Let me give you an example; https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-2.html and https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-perl-4.html The Python code uses ctypes, thus the unfair marginal difference. I have seen the same un…
No they do not.
Let me give you an example:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
*** You ignored the Python code that does not use ctypes.
> I have seen the same unjust comparison with the majority of the examples…
No you have not.
There are 10 different tasks.
pidigits accepts the use of third-party libraries (GMP)
regex-redux accepts the use of third-party libraries (PCRE)
That's 2 out of 10.
Re: PHP is worth learning and using
#414Re: PHP is worth learning and using
#415Earlier quoted context omitted.
(naieve fibonacci) like this: just did some measurements on my laptop: | Language | n | time(s) | |----------------------+----+---------| | php (7.4.25) | 42 | 422.0 | | python3 | 42 | 90.0 | | haskell (ghc -O3) | 42 | 13.8 | | f# | 42 | 5.6 | | ts | 42 | 2.8 | | ocaml (ocamlopt -O3) | 42 | 0.98 | | C (gcc -O3) | 42 | 0.66 | (edit: added php version in table. )
This is what I get locally: time php fib.php 42 23s time python3 fib.py 42 1m1s I suspect that you're doing something very wrong, like running PHP with an active debugger or similar. If we're talking in comparison to slow interpreted languages like Python, then function calls in PHP are not particularly expensive. Debuggers can make them quite expensive though. Edit: Just to note, PHP's execution time drops to 4s wit…
Something doesn't quite add up across everyone's results here, but the extremely slow result at the top of the thread is almost certainly a debugger slowing things down.
Edit: I was missing `opcache.jit_buffer_size`, and saw the runtime drop to under ten seconds with that correctly configured.
Re: PHP is worth learning and using
#416PHP has nothing to offer. They HAVE cleaned up some of the idiotic behaviour, but much of it still remains.
The stdlib is very poor, and having last i looked everything was still global. Some array functions like map/filter had arguments in the wrong order.
Unicode support is not there. Its a web language for gods sake! How about focus on that as a high priority?
PHP lacks a vision. What does PHP want to be/become? It looks like sometimes PHp steals Javalike features, implements them adhoc and badly, and then again sometimes more scripy features from JS.
The typ system is VERY mediocre. You really cant trust it, at least not with the stdlib.
The execution model of PHP is still living in the early 2000s. The web is real time, and PHP cant handle it without hacks, and even then you cant use any builtins like PDO (blocks thread) or any IO related feature.
Honestly, even if PHP today is ”better” than it was 10 years ago, what does it have to offer? There are multiple better languages for the problem PHP solves, and the other languages have ALSO improved in the last decade.
I cant see myself starting a new project with PHP, there is just too little it offers, and too much thats still broken, and wont ever be fixed because of BC that PHp tries so hard to keep.
Re: PHP is worth learning and using
#417To me personally PHP is the cheapest way of building a dynamic website. Just a few euros/dollars a month will get you a shared web hosting plan with full support for the LAMP stack & free email.
Re: PHP is worth learning and using
#418Earlier quoted context omitted.
Tons of sites are written exclusively in Python. Django alone has 60k stars and 25k forks on Github. That about the same as Laravel.
A quick search came up with an order of magnitude more sites in laravel than django. And combined are still a small fraction of sites on the internet.
Re: PHP is worth learning and using
#419PHP is doing very poorly in this realm. How many PHP websites out there are actually using a few libraries and the stdlib only? Not many.
Its frameworks, frameworks frameworks. In the PHP case its actually even worse, as there are a multitude of CMS sysytems that some people use. So its not even programming, but point and click and copypaste.
Thats not a tool i eant to use in 2021.
Re: PHP is worth learning and using
#420Earlier quoted context omitted.
Comparing Rails to PHP is unfair given that one is a framework and one is a programming language. Compare PHP and Ruby or Rails and Laravel to keep things apples to apples and oranges to oranges.
A lot of people 10+ years ago were building websites by interpreting PHP and using the output as HTML. The language (at the time) seemed to encourage this. I agree that PHP is not a framework, but it seemed to have some opinion on how HTML was to be generated, which most languages don’t have. Also rails is 7 years older than Laravel, so my point still stands that PHP was behind the curve.