- This topic has 10 replies, 1 voice, and was last updated 2 months, 2 weeks ago by [deleted].
- November 5, 2020 at 12:07 am #1568JosephLeedyParticipant
PHP 8.0 feature focus: quality of life improvementsNovember 5, 2020 at 12:07 am #1569todburGuest
I love seeing features being added that address the pain points I have from day to day. I’ve written a `str_starts_with()` function so many times. Usually after battling with `substr_compare()`’s edge cases. Then I start a new composer package and forget I need to write that little function all over again. It really gives you [that little frustrated feeling](https://giphy.com/gifs/season-5-the-simpsons-5×2-3o6Mbtdd7dhvbvugg0/fullscreen) when you are just trying to get work done.
What I’ve noticed though is that the internals team is always adding these little things that address productivity issues. These real ass improvements for real ass problems have been coming in consistently since PHP 5.3. It really makes me feel like they are right on my wavelength and I sincerely appreciate it.November 5, 2020 at 12:07 am #1570cpellensGuest
I wish PHP would ditch its functional patterns. I want to see a more C#-style pattern where strings are native classes with methods.
$myString = ‘Hello World’;
echo $myString->startsWith(‘Hello’) ? ‘Yes’ : ‘No’;
echo $myString->match(‘/^Hello/’) ? ‘Yes’ : ‘No’;November 5, 2020 at 12:07 am #1571FloridaCatFishGuest
They didn’t mention named parameters? That’s the biggest QOL improvement for me.November 5, 2020 at 12:07 am #1572bobjohnsonmilwGuest
what is the point of trailing commas? what problem is this solving?November 5, 2020 at 12:07 am #1573_fluxy_Guest
I’m slightly disappointed that the string functions are not utf8 compatible. They are still useful but I do hope their utf8 equivalents exist for relevant use cases.November 5, 2020 at 12:07 am #1574iamkira7Guest
I just read the previous article in this blog which talks about the nullsafe operator. But that’s only in PHP 8. What about versions before that? What’s a good way to handle null variables? I feel the conditional statements get in the way of clean code.November 5, 2020 at 12:07 am #1575burzum793Guest
Great, some more str_* functions… When can we get proper String and Array / Collection classes? php 9 or 10? 🙁 All the legacy can stay and these new classes could finally get a proper and sane API:
String::find(‘word’, ‘this word in this string’)
Or non static:
$string = new String(‘FOO’)
echo $string; // implements toString(), echos ‘foo’
Just make a little more c#-ish and .net like and I’ll love php even more. 🙂November 5, 2020 at 12:07 am #1576ahmedxaxGuest
i just wish functions naming are like this
strStartsWith instead of str_starts_withNovember 5, 2020 at 12:07 am #1577[deleted]Guest
[deleted]November 5, 2020 at 12:07 am #1578[deleted]Guest
- You must be logged in to reply to this topic.