PHP 8.0 feature focus: quality of life improvements

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1568
    JosephLeedy
    Participant

    PHP 8.0 feature focus: quality of life improvements

    #1569
    todbur
    Guest

    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.

    #1570
    cpellens
    Guest

    I wish PHP would ditch its functional patterns. I want to see a more C#-style pattern where strings are native classes with methods.

    ​

    Ex:

    $myString = ‘Hello World’;

    echo $myString->startsWith(‘Hello’) ? ‘Yes’ : ‘No’;

    echo $myString->match(‘/^Hello/’) ? ‘Yes’ : ‘No’;

    #1571
    FloridaCatFish
    Guest

    They didn’t mention named parameters? That’s the biggest QOL improvement for me.

    #1572
    bobjohnsonmilw
    Guest

    what is the point of trailing commas? what problem is this solving?

    #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.

    #1574
    iamkira7
    Guest

    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.

    #1575
    burzum793
    Guest

    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’)
    String::startsWith(‘foobar’, ‘foo’)
    String::toLower()
    Or non static:

    $string = new String(‘FOO’)
    $string->toLower()
    echo $string; // implements toString(), echos ‘foo’

    Just make a little more c#-ish and .net like and I’ll love php even more. 🙂

    #1576
    ahmedxax
    Guest

    i just wish functions naming are like this
    strStartsWith instead of str_starts_with

    #1577
    [deleted]
    Guest

    [deleted]

    #1578
    [deleted]
    Guest

    [deleted]

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.