Open chrisblakley opened 4 years ago
https://php.watch/versions/8.0/str_starts_with-str_ends_with
str_starts_with()
and str_ends_with()
coming to PHP 8.
I know this is for PHP v8, but some other things to note regarding PHP 7.4:
fn()
??=
123_456_789.01
//PHP 7.4 use numeric separators here
comments for these7.4 is in mainstream support right now, but until it is the minimum supported version we can't implement these in Nebula. Could be a few years before that happens. Probably at least January 2022.
Moved this comment to: https://github.com/chrisblakley/Nebula/issues/2147
For PHP 8 we're probably looking at January 2023...
Named Arguments is added to the list as well: https://stitcher.io/blog/php-8-named-arguments
setcookie(
name: 'test',
expires: time() + 60 * 60 * 2,
);
The match expression seems really useful too:
$result = match($input){
0 => "hello",
'1', '2', '3' => "world",
};
So in this case if $input
was 2
, then $result
would be set to world
.
Another example of match()
:
In the meantime, testing can be performed on WP Taste: https://tastewp.com/
Here's my more specific guesstimates at PHP minimum version update dates: #2089 (comment)
Once we bump to 7.2 and then 7.3, I'll update #2147 with the next guesstimate and then this issue with the one related to PHP 8 and so on.
New guesstimate: https://github.com/chrisblakley/Nebula/issues/2147#issuecomment-1115731046
Thinking sometime in 2023 for minimum version to 8.0... https://github.com/chrisblakley/Nebula/issues/2147#issuecomment-1115731046
Noting locations to update strpos()
with str_contains()
with the following comment:
//@todo "Nebula" 0: Update strpos() to str_contains() in PHP8
Edit: Be careful of some locations that are using strpos() to actually get the index (and not just detect if a string contains another string)!
Usage statistics as of January 2024.
I'm thinking the threshold for minimum v8 is when 7.4 goes under 5%.
PHP Version Timeline: https://www.php.net/supported-versions.php PHP Release Notes: https://php.watch/versions
PHP 8.0 Info & References
https://php.watch/versions/8.0 https://stitcher.io/blog/new-in-php-8
Projected Nebula Minimum Version Timeline
Notable Features related to Nebula in PHP 8.0
Launch window is around December 2020, but will be much longer before we can make use of these in Nebula.
str_contains()
str_starts_with()
andstr_ends_with()
Old:
New: