What's new in PHP 8.4?

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น • 85

  • @imqqmi
    @imqqmi 2 หลายเดือนก่อน +53

    PHP more and more looks like C#, I think it's a good thing.

    •  2 หลายเดือนก่อน +4

      PHP#

    • @imqqmi
      @imqqmi 2 หลายเดือนก่อน

      Very sharp!

    • @stjepanmajdak7396
      @stjepanmajdak7396 2 หลายเดือนก่อน +1

      And C# is getting some unique PHP features with almost every new version

    •  2 หลายเดือนก่อน

      @@stjepanmajdak7396 could you elaborate? That's interesting. I'm just curious, I've been using C# only little, two digits years ago.

  • @erickdeazevedolima1763
    @erickdeazevedolima1763 2 หลายเดือนก่อน +17

    I've been waiting for the asymetric visibility + property hooks combo for a decade (I used them in C# all the time before diving for real in PHP). I'm really excited for it.

  • @fabio.antunes
    @fabio.antunes 2 หลายเดือนก่อน +2

    Hello. Just found your channel thanks to this video. Thanks for the summary and straight to the point examples. Awesome.

  • @zonegamma8197
    @zonegamma8197 2 หลายเดือนก่อน +2

    cool to see the language evolving a lot these last years

  • @GuzikPL4
    @GuzikPL4 2 หลายเดือนก่อน +2

    Some time a go Aaron Francis did a video about what changed in PHP since 2012 and i absolutely love these kind of videos. I would love to see more tricks and cool features i can use.

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน +2

      Ah yes, I remember that video. Aaron's great!
      In my defence though, I was the first one to do such an evolution video (and Aaron made a better version inspired by mine :p )
      th-cam.com/video/x9bSUo6TGgY/w-d-xo.html

  • @qqleq
    @qqleq 2 หลายเดือนก่อน +3

    Love it all! I used property get/set/let all the time when I was programming in VBA I think even thirty years ago! Finally I can do something similar, but better, in PHP. I think I will use almost all of the updates immediately, I have been needing them all for quite some time.

    • @pierrepracht
      @pierrepracht 2 หลายเดือนก่อน

      30 years later...

      Only in PHP !

  • @nobodyspecial946
    @nobodyspecial946 2 หลายเดือนก่อน +9

    I rewinded more than 5 times to moment 3:36 :D They way you said it and you face expression make me laugh so much :D "It took them more than decade to add, but HEY! IT'S HERE"

  • @3fcf91cb4e
    @3fcf91cb4e หลายเดือนก่อน

    Would love to see your view on Magento's approach to backend, or maybe an interview with someone experienced with it - there's a lot of interesting stuff to talk about.
    I've been working with it for years and there's so many awful implementations of this platform that maybe a video on the standards and principles it uses could help some developers realize how much stuff they do wrong.
    And not going to lie - a video/podcast that would summarize some of the basic PHP principles and guidelines (not even diving into detail) would be a blessing for the juniors I work with, not sure if you have one already

  • @lostcarpark
    @lostcarpark 2 หลายเดือนก่อน +3

    Very excited about property hooks, though asymmetric visibility means most of the time they won't even be needed.

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน +1

      Absolutely true! Gonna be HUGE

  • @taghwomillionaireo.5543
    @taghwomillionaireo.5543 2 หลายเดือนก่อน +1

    Didn’t really understand the asymmetric visibility RFC, thanks for the explanation

  • @NeverCodeAlone
    @NeverCodeAlone 2 หลายเดือนก่อน

    Very good video. Thanks a lot.

  • @xelframework
    @xelframework 2 หลายเดือนก่อน +1

    properties hook are very interesting feature so far on php 8.4

  • @Pekz00r
    @Pekz00r 2 หลายเดือนก่อน

    Asymetric visibility is a game changer! I tend to use public properties more often than I should because it is so annoying to create and call getters for every property. I'm really looking forward to never write a simple property getter without any logic again. For the times you need some basic logic property hooks are also great!

  • @coder236
    @coder236 2 หลายเดือนก่อน +2

    When they eventually bring out 9 I'd love them to add a decent concurrency model

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน +1

      Oooh yeah that would be nice! I remember some people were looking at lib-uv compatibility around the 8.0 era for async/await support, but I don't think anything came from it

    • @coder236
      @coder236 2 หลายเดือนก่อน +2

      @@phpannotated if they could add it i think php would boom again. i love php but have been thinking of handing certain tasks over to a node or GoLang server for heavy lifting. anyway, keep up the awesome content ✌

    • @lostcarpark
      @lostcarpark 2 หลายเดือนก่อน +1

      Fibres gets close, especially with revolt, and I think could be developed into full concurency. What I don't like about async/await in JS is the way it is used for many things that 99% of the time you want to use completely synchronously, but you have to include asynchronous boilerplate for the rare asynchronous use cases. I hope we can come up with a syntax that enables better concurency without imposing extra burden on simple use cases that just want to call an action and wait for it to finish.

    • @zebraforceone
      @zebraforceone 2 หลายเดือนก่อน

      Check out fibres

  • @pranansubba9587
    @pranansubba9587 2 หลายเดือนก่อน

    Idk why but getter and setter sounds quite logical if working in framework.

  • @llBestBoyll
    @llBestBoyll 2 หลายเดือนก่อน

    That was vert informative thx ❤

  • @mr_raspberry_jam
    @mr_raspberry_jam 2 หลายเดือนก่อน +1

    Where can I get one of them php elephants you have behind you?

  • @Tigerman55
    @Tigerman55 2 หลายเดือนก่อน

    I think property hooks are more applicable to legacy projects (maybe), than it is to new code. You can use readonly classes and then you don't need any getters or setters anyways. Passing objects into a service with named constructors prevents the need for logic in either getters or setters. So it is moot point for most modern cases.
    Readonly with only private mutation is useful in some cases, I think.

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      Not necessarily, you might want to set certain values in the constructor based on another value. Currently you either do it when you instantiate the class, or in the constructor but you move the property from being defined in your constructor method to being as a class property.
      The read only private thing is more than you can finally use the interfaces to define this functionality while currently you can only have props public.

  • @SXsoft99
    @SXsoft99 2 หลายเดือนก่อน

    My DTO classes will become much cleaner :))

  • @GopherOnline
    @GopherOnline 2 หลายเดือนก่อน +1

    echo great video

    • @ramizazhar8891
      @ramizazhar8891 2 หลายเดือนก่อน

      forgot the ""

    • @GopherOnline
      @GopherOnline 2 หลายเดือนก่อน

      @ramizazhar8891 😁

  • @abrahamolaobaju1781
    @abrahamolaobaju1781 2 หลายเดือนก่อน

    looking good

  • @badasukerubin
    @badasukerubin 2 หลายเดือนก่อน

    I can't wait for property hooks

  • @rustix3
    @rustix3 2 หลายเดือนก่อน

    I see a lot of things available in other languages are adopted in PHP, which is good.
    But when will set and map/dictionary data types be available outside of the box in PHP?

    • @zebraforceone
      @zebraforceone 2 หลายเดือนก่อน

      Associative arrays are a map

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      do you work only with auto indexed arrays?
      have you never done:
      $arr=[];
      $arr['name']='test';
      $arr['list']=['test_key' => 'text_val'];
      ?

  • @prometheus6001
    @prometheus6001 2 หลายเดือนก่อน

    What IDE is that and if its IDEA, what template or how did you get to that look and feel?

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน

      It's PhpStorm with the new layout (enabled by default in newest installs), and my custom color scheme: github.com/brendt/phpstorm-light-lite-theme

  • @svobodnjk
    @svobodnjk 2 หลายเดือนก่อน +2

    And still no generics... 😢

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      you kinda have them as comments but not enforced :))
      /** @var array $variable */
      It helps with the IDE a lot
      you can also have complex ones
      /** @var array{name:string, tags:array{name:string}} */
      works with @prop/@property-read/@method

  • @CottonInDerTube
    @CottonInDerTube 2 หลายเดือนก่อน

    3:00 That feels wrong. Doesnt this require a __construct to return $this (which actually returns void only)?

    • @krycekaiolfi
      @krycekaiolfi 2 หลายเดือนก่อน

      The __construct is, returns void. But the 'new' keyword returns an object.

  • @31redorange08
    @31redorange08 2 หลายเดือนก่อน

    Are there any use cases for PHP outside of extending CMS?

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      - server-side CLI(Terminal) scripting,
      - automatic queue system in conjunction with linux supervisorCTL
      - desktop apps(be it a niche)
      - Web APIs, you can respond with Json, xml, file stream, etc. You are not limited to HTML

    • @31redorange08
      @31redorange08 2 หลายเดือนก่อน

      @SXsoft99 I know that these things are possible, but why would you choose PHP over other languages (other than only knowing PHP)?

    • @merlin-1d
      @merlin-1d 2 หลายเดือนก่อน

      Yes, if you're a developer and you're honest with yourself, you know exactly why😉

    • @LatenightDev
      @LatenightDev 2 หลายเดือนก่อน

      @@31redorange08 Who says that ? What makes you think those who use PHP don't use other languages?

    • @31redorange08
      @31redorange08 2 หลายเดือนก่อน

      @@LatenightDev That's not what I was saying.

  • @marius-v4s
    @marius-v4s 2 หลายเดือนก่อน

    property hooks in interfaces is fucking huuuuge, they're cooking good

  • @asagiai4965
    @asagiai4965 2 หลายเดือนก่อน

    Hmm the ability to make setter private.
    Where have I seen that? Ah yes VB
    Maybe there's also in C#
    Anyway I think these are ok features.

  • @robwatson826
    @robwatson826 2 หลายเดือนก่อน

    All I want is a function autoloader then I'll be totally happy with PHP

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      in your composer.json
      {
      ...,
      "autoload": {
      "files": [
      "app/Helpers/helpers.php",
      ],
      },
      ...
      }

  • @honk_tm
    @honk_tm 2 หลายเดือนก่อน +1

    yes, I hate property hooks, other things are absolutely welcomed

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน

      Fair enough!

  • @farhanasultana9213
    @farhanasultana9213 2 หลายเดือนก่อน +2

    PHP needs front end async features instead on relying on js, which will make it a full stack language.

    • @LatenightDev
      @LatenightDev 2 หลายเดือนก่อน

      php doesn’t need to be asynchronous. as every request uses its own php thread. need to scale php? add more workers in your webserver. need to scale nodejs: run multiple instances behind a load balancer and carefully manage listening ports. php makes life easy, when low latency isn’t a strict requirement.

  • @aurelian3401
    @aurelian3401 2 หลายเดือนก่อน +1

    print 'ok'; // amazing

  • @susanthawarnapura
    @susanthawarnapura 2 หลายเดือนก่อน +4

    forget PHP 8.4 we need generic support and strict types

  • @nikolayivanov321
    @nikolayivanov321 2 หลายเดือนก่อน

    Not sure how I feel about being able to use property hooks for promoted properties, I can see this getting ugly real fast. Other than that, it seems like a fantastic release.

  • @holonaut
    @holonaut 2 หลายเดือนก่อน

    Generics when?

    • @jsomhorst
      @jsomhorst 2 หลายเดือนก่อน

      Never. Search and see it is really hard to implement in a language like this

    • @holonaut
      @holonaut 2 หลายเดือนก่อน

      @jsomhorst actually generics already work with annotations and phpstan. PHP maintainers are just not adding it to the language out of spite at this point

    • @jsomhorst
      @jsomhorst 2 หลายเดือนก่อน

      @holonaut yes I know. That is the IDE doing it's thing. PHP doesn't care.

  • @David-ng9qh
    @David-ng9qh 2 หลายเดือนก่อน

    I really dislike the new deprecation of the implicitly marking a function parameter as nullable if it's default value is null. This was a great marker that a user should not pass in null, but that the implementation would resolve to a default (non-const) value at runtime if nothing was provided. I do not understand why this is deprecation worthy, I get that it is a weird thing, but it is also a great design pattern and is quite literally used everywhere. I use it everywhere, and laravel/framework does too.
    I understand just making the type nullable does not affect the way PHP handles this scenario at all, but it's about the semantics the consumer of a library will deal with, which will now be worse.
    Example
    ```php
    function a(int $b = null) {
    $b ??= get_default_value_for_b();
    // ...
    }
    a(); // user knows not to pass in null
    a(1); // good

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน

      Interesting! I personally never considered that use case 🤔

    • @SXsoft99
      @SXsoft99 2 หลายเดือนก่อน

      they want to do it because a lot of devs abuse it and it leads to a lot of errors

  • @a-yon_n
    @a-yon_n 2 หลายเดือนก่อน

    Yet still doesn't have variable type notations and generics. It's frustrating to see a language evolve so much but actually change so little. I will never use PHP again until it has these two features.

  • @turi.commodore
    @turi.commodore 2 หลายเดือนก่อน

    i'm thinking of all the useless getters in my aggregates that will FINALLY be dropped thanks to private(set)....
    hell yeah

  • @MLHAFAKOT
    @MLHAFAKOT 2 หลายเดือนก่อน

    Stop using bright mode

    • @phpannotated
      @phpannotated  2 หลายเดือนก่อน

      th-cam.com/video/mu0HJ0_kprc/w-d-xo.html

  • @CottonInDerTube
    @CottonInDerTube 2 หลายเดือนก่อน

    0:50 omg! Im not bi***ing, i just dont understand why this would make things better :D
    But hey - we can still use getters and setters =)
    _Which i will 100% do until i die._

    • @Someniatko
      @Someniatko 2 หลายเดือนก่อน

      One use case is that you can add more logic to an already existing without having to convert all its users to use a getter/setter, keeping backwards compatibility

  • @Rhmtsky
    @Rhmtsky 2 หลายเดือนก่อน

    Meh, i'll stick to 8.2 til php 9 released then.

  • @danser_theplayer01
    @danser_theplayer01 2 หลายเดือนก่อน

    The language name sounds like some old vacuum cleaner coughed up dust.
    pghhp💨

  • @MelroyvandenBerg
    @MelroyvandenBerg 2 หลายเดือนก่อน

    HTML5 support took only a decade to add hhaha. Classic

  • @Alex-pg1gt
    @Alex-pg1gt 2 หลายเดือนก่อน +1

    Meh

  • @rickmyers7627
    @rickmyers7627 2 หลายเดือนก่อน

    Why not use magic methods for getting rid of getters and setters... seriously, this reason is why I left programming Java... PHP's magic methods, and autoloaders, are amazing and make coding "conventions over configuration" a breeze.

    • @krycekaiolfi
      @krycekaiolfi 2 หลายเดือนก่อน

      Magic methods doesn't play nice with static analysis, intellisense, etc.