What's New in PHP 8.1
stitcher.io
What's New in PHP 8.1
1–10 of 112 posts
Re: What's New in PHP 8.1
#2 $array = array_merge(["a" => 0], $array1, $array2);
could be replaced with this: $array = ["a" => 0, ...$array1, ...$array2];
It seems small here, but anything that stops devs from having to nest a bunch of array*() calls in PHP is an excellent change. I don't know how many times I've come across code that does something like this: $array = array_values(array_unique(array_filter(array_merge($one, $two, $three))));Re: What's New in PHP 8.1
#3I 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.
Re: What's New in PHP 8.1
#4Array unpacking is going to help make a lot of coding situations more concise. There isn't a direct comparison in the article, but from what I understand, something like this: $array = array_merge(["a" => 0], $array1, $array2); could be replaced with this: $array = ["a" => 0, ...$array1, ...$array2]; It seems small here, but anything that stops devs from having to nest a bunch of array*() calls in PHP is an excellent…
Re: What's New in PHP 8.1
#5Array unpacking is going to help make a lot of coding situations more concise. There isn't a direct comparison in the article, but from what I understand, something like this: $array = array_merge(["a" => 0], $array1, $array2); could be replaced with this: $array = ["a" => 0, ...$array1, ...$array2]; It seems small here, but anything that stops devs from having to nest a bunch of array*() calls in PHP is an excellent…
Good to have this in PHP. It's called "spread" in JavaScript.
Re: What's New in PHP 8.1
#6"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.
Re: What's New in PHP 8.1
#7Array unpacking is going to help make a lot of coding situations more concise. There isn't a direct comparison in the article, but from what I understand, something like this: $array = array_merge(["a" => 0], $array1, $array2); could be replaced with this: $array = ["a" => 0, ...$array1, ...$array2]; It seems small here, but anything that stops devs from having to nest a bunch of array*() calls in PHP is an excellent…
Good to have this in PHP. It's called "spread" in JavaScript.
Re: What's New in PHP 8.1
#8"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.
Re: What's New in PHP 8.1
#9"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.