One thing I still love about PHP is that it's so easy to deploy. No need for fancy Amazon Web Shmervices, no need for Jamstack jumping through the hoops. Just find any host that supports PHP, upload your file, and done.
> no need for Jamstack jumping through the hoops. "Jamstack" sites, in their simple form, or even combined with a modest number of lambda functions, can be deployed to github pages / netlify / vercel and a number of other platforms for free. Push a commit to github, get an automatic deployment going, boom, done. I am not aware of any analogues in the php ecosystem.
What's New in PHP 8.1
91–100 of 112 posts
Re: What's New in PHP 8.1
#92One thing I still love about PHP is that it's so easy to deploy. No need for fancy Amazon Web Shmervices, no need for Jamstack jumping through the hoops. Just find any host that supports PHP, upload your file, and done.
Re: What's New in PHP 8.1
#93Earlier quoted context omitted.
I don't use PHP anymore, but I used it for years in production. Was pretty easy to maintain (via Apache's mod_php).
It is a problem to maintain. Simple example: how do you remove sessions in a multi server environment? Well, you can set a config to do that at random which imposes a cost for that particular request. Or you can run a corn job. This is not a decision in most other scripting languages. Don’t get me started on concurrency either...
PHP solves concurrency very well - it just passes the problem to the web server.
If you need multithreading to service a http request then you are either doing something wrong, or over-engineering the problem. Other language platforms also service requests in a single thread, including Node.
Re: What's New in PHP 8.1
#94Earlier quoted context omitted.
It is a problem to maintain. Simple example: how do you remove sessions in a multi server environment? Well, you can set a config to do that at random which imposes a cost for that particular request. Or you can run a corn job. This is not a decision in most other scripting languages. Don’t get me started on concurrency either...
This is a decision in all scripting languages. PHP solves concurrency very well - it just passes the problem to the web server. If you need multithreading to service a http request then you are either doing something wrong, or over-engineering the problem. Other language platforms also service requests in a single thread, including Node.
Re: What's New in PHP 8.1
#95One thing I still love about PHP is that it's so easy to deploy. No need for fancy Amazon Web Shmervices, no need for Jamstack jumping through the hoops. Just find any host that supports PHP, upload your file, and done.
That's not just PHP, you can use anything that supports CGI, and lots of shared hosting have pre-installed Perl and Python as well as PHP.
With PHP you can just drop it anywhere in the htdocs and done.
Re: What's New in PHP 8.1
#96Earlier quoted context omitted.
What `array_is_list()` changes is that it makes this check fast . Previously, the fastest method of checking for a list-like array was `$arr == array_values($arr)`, which was slow on large lists and could fail entirely on some unusual structures containing circular references. (I was involved in the development of this function: https://github.com/php/php-src/pull/4886 )
Is array_is_map(), etc, planned? Or is the pure php equivalent fast enough for those?
As far as PHP is concerned, a list is a subset of arrays where the keys are ordered integers starting at zero. Any array that doesn't fit this pattern could be considered a "map" -- there's no middle ground.
Re: What's New in PHP 8.1
#97Earlier quoted context omitted.
> I can’t count how many times this conflation wasted my time and introduced various bugs Could you give examples of this? I'm of the opinion PHP could use more strictly typed arrays/lists, but I haven't run into any issues with PHP arrays myself.
The one that annoyed me recently - numeric-looking string keys are turned into numeric keys. So if you have eg a hashmap of [naughty_word => replacement], then [“penis”=>”willy”] and [“asshole”=>”bottom”] work fine, but [“69”=>”cuddle”] crashes your program with an "unexpected integer” exception.
edit: itchy trigger finger
Re: What's New in PHP 8.1
#98Earlier quoted context omitted.
> no need for Jamstack jumping through the hoops. "Jamstack" sites, in their simple form, or even combined with a modest number of lambda functions, can be deployed to github pages / netlify / vercel and a number of other platforms for free. Push a commit to github, get an automatic deployment going, boom, done. I am not aware of any analogues in the php ecosystem.
You dont need to sign up to multiple sites and maintain multiple accounts. You don't even need to use Git or lambda functions. That's what I mean by jumping through hoops. With PHP I just upload the file and done. Nothing beats this simplicity. For simple stuff, it's my favorite.
For JAMStack, just git push and done. I don't see PHP is easier ;)
Re: What's New in PHP 8.1
#99"New array_is_list function" I use PHP a fair amount, but this is one area that irks me. PHP arrays can be arrays, lists, and hash maps. PHP obviously copied some of Perl's features, and I never understood why hashmaps and arrays weren't different types, as they are in Perl.
Funny. I almost dislike all of PHP but think that their choice of basic data structure is the one good thing. Computers are getting faster and faster and simplifying programming could be done to a whole new level. Clojure for example has a similar approach. Okay, PHP lacks contracts, but maybe PHP adds them in 20 years when the mainstream understands that they are great.
In fact, they're getting slower in real practice. (We've been trading off speed for safety and power consumption for years now.)
Re: What's New in PHP 8.1
#100Earlier quoted context omitted.
Easy to get started.. nightmare to maintain aftewards.
I don't use PHP anymore, but I used it for years in production. Was pretty easy to maintain (via Apache's mod_php).
Contrast that with going up one major version in Scala where all I need to do is fix the compile errors and then I’m confident it won’t surprise me with runtime errors.