PHP 8 3 Released

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 342

  • @Taverius
    @Taverius Рік тому +287

    PHP has been good for years.
    At the same time, old, unsupported, terminally insecure PHP versions have become the IE6 of backend development.
    If you learn PHP and want to use that skill for money you have to be super duper extra careful not to end up working on one of these legacy backends, and they are LEGION.
    There are tens of thousands of company/corporate sites running PHP versions that haven't seen a security update in over a decade. 😨

    • @FunctionGermany
      @FunctionGermany Рік тому +31

      any time i see such an app i feel like it's better to just rebuild it with Laravel and the latest PHP version. the code is probably shit anyways so just extract the business requirements and ignore the old code as much as you can.

    • @TNeulaender
      @TNeulaender Рік тому +27

      I already modernized 2 companies from 5.x to 7.x (few years ago) and 8.x (also some while ago). And to be really honest: I like cleaning up.
      Especially the first part was a HUGE mess. It was php building html pages with embedded javascript using objects, dynamically created inline in . It was .... marvelous :D

    • @spicynoodle7419
      @spicynoodle7419 Рік тому +5

      @@TNeulaender oh man, I love seeing vuejs components with a bit of jQuery and PHP all intertwined. It's the worst. PHP 8 is glorious. It's a lot better than JS

    • @Rakkoonn
      @Rakkoonn Рік тому +6

      Just never take a "PHP" job, only Symfony/Laravel jobs. There is not much to learn about PHP specifically anyway, you are mostly learning frameworks not language itself.

    • @FunctionGermany
      @FunctionGermany Рік тому +5

      @@Rakkoonn then it's the same with Java at least. who builds Java web apps without Spring or that other framework?
      there are "PHP" jobs. we literally have a position open for that at the company i work in. it's a DIY-ed PHP web app - no framework. (it also sucks but that's not relevant to the point)

  • @steveaguay
    @steveaguay Рік тому +129

    Php is actually fine now. it's not the most flashy or modern experience but it's good enough. Pair it with laravel and it does a lot of things right.

    • @BeatsByVossy
      @BeatsByVossy Рік тому +77

      PHP pays my bills just fine :)

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Рік тому +145

      i want to try laravel

    • @soroushjm1011
      @soroushjm1011 Рік тому

      ​@@ThePrimeTimeagenplease try asp for our amusement 😂, we like see you suffer 😂

    • @danielvigh8211
      @danielvigh8211 Рік тому +9

      Please make it into a video or I will send you a lexer in php. Take it as a threath @@ThePrimeTimeagen

    • @barneylaurance1865
      @barneylaurance1865 Рік тому +14

      @@ThePrimeTimeagen Try Symfony. Or if you try Laravel try to not to use ambient context (instead of dependency injection) as much as the docs encourage.

  • @fus-ro-dah
    @fus-ro-dah Рік тому +89

    The clone stuff is actually brilliant. It's for immutability.
    Suppose you have a readonly class. You can have its properties be public and readonly - so no getters. But before PHP 8.3, you could not derive new copies of instances of readonly classes, unless you go through the constructor.
    So now we can have a class with immutable methods that can efficiently generate cloned derivations.
    Ex: $user->withName("New name");
    Internally, `withName()` would clone $this and update the name property on the cloned instance.

    • @barneylaurance1865
      @barneylaurance1865 Рік тому +2

      Yeah I wonder if the example on the PHP release announcement is the best example. Something like what you're showing with a `wither` method might be clearer.

    • @Betacak3
      @Betacak3 Рік тому +4

      Unfortunately, it's not like that. You can't modify the name property from the withName method. The only place that allows modification of readonly properties is the magic __clone method, which you can't pass any data to.

    • @barneylaurance1865
      @barneylaurance1865 Рік тому

      @@Betacak3 Yeah. I guess you could do some hack thing like stuffing the data into a private static property for __clone to pull it out and know what to modify, relying on the fact that PHP is effectively single threaded. Would be ugly but might work fine if you don't have to read the implementation too often.

    • @Betacak3
      @Betacak3 Рік тому +1

      @@barneylaurance1865 You can't do that either. On a readonly class, everything is automatically readonly, including static properties. But static properties can't be readonly, which makes sense, because at that point they'd just be class constants. So declaring a static property in a readonly class is actually an error.
      Out of curiosity, I tried modifying the new instance with reflection, but even that doesn't work. I actually see no way to make wither methods for readonly classes with what we have right now.

    • @barneylaurance1865
      @barneylaurance1865 Рік тому

      @@Betacak3 Oh yeah I forgot about that restriction. You'd have to make a second class to hold those static properties. Optionally then the statics could be done via a WeakMap so you have one per instance instead of just one for the object being cloned currently.

  • @roelhemerik5715
    @roelhemerik5715 Рік тому +26

    PHP still has the most potential in its Foreign Function Interface, as the language was designed with that in mind in the first place. It’s a shame they do not focus more on making that part of the language more user friendly.

  • @mme725
    @mme725 Рік тому +59

    Random note, a theory on why the PHP namespace delimiter is `\` is because the foreard slash `/` was already the division operator so it was easier at the time to drop the backslash into the parser.
    Similar reason as to why it didn't use the `::` operator C++ uses, since it was already in use for static calls.

    • @mihalious
      @mihalious Рік тому

      If i do understand correctly, that static call is a method defined on classs and not on instance, isn't this exactly how rust uses "::"?
      use std::collections::HashMap;
      let m = HashMap::new();
      So it's possible to have semicolons for both things(?)

    • @Luclecool123
      @Luclecool123 Рік тому +4

      They went LaTeX mode

    • @dzhukov
      @dzhukov Рік тому +11

      They could not use `.` as a delimiter as well because it is reserved for string concatenation in PHP.

    • @mme725
      @mme725 Рік тому +2

      @@mihalious the most part yeah. But PHP's parser is different from Rust, and it's got a lot of legacy/BC cruft going on. They could have made it do both and be more contextually aware, but that's just not how it played out historically unfortunately.
      Fast forward like 14 years now and if you swap it out you break the ecosystem.

    • @hacktor_92
      @hacktor_92 Рік тому

      actually... it was a whole stuff itself back in the days. look up for "php rfc namespace separator" for more info. in the footnote, there's also the full chat history about why they ruled out `::` ns separator (hint: T_PAAMAYIM_NEKUDOTAYIM)

  • @justjess5891
    @justjess5891 Рік тому +51

    I really do wonder whether Prime would like Laravel or not. IMO Laravel is an antithesis to anyone who likes Go. Go is all about simplicity while Laravel is all magic and abstractions upon abstractions. I would say Laravel is more akin to React or Next.js specifically in that in React/Next.js you are not writing just plain JS, but the React way of writing JS. Similarly, Laravel is not really PHP at this point, but almost like its own language built on top of PHP. Also, just as there are many people who learn React before they learn vanilla JS, there are also many people who jump straight into Laravel without bothering to master PHP and I don't think that is a good thing in either case

    • @SAS-qq5ce
      @SAS-qq5ce Рік тому +9

      Agree, i started with laravel 3 and thought i knew php until i applied for senior php dev position and found out that i knew nothing

    • @JohnDoe-jk3vv
      @JohnDoe-jk3vv Рік тому +1

      That's just a problem with frameworks and people trying to get a job. The framework is there to help the experienced programmers first and foremost. The inexperienced ones are expected to get up to speed on the framework because that's what the company uses. So there's not much time/incentive to master the language first and learn the framework second.

    • @ra2enjoyer708
      @ra2enjoyer708 11 місяців тому

      What are you talking about? Out of Big 3 frontend frameworks React is closest to writing vanilla JS, that's why it's pretty easy to slap on typescript (which also supports react templates out of the box) and get all static analysis goodies.
      You will get the same problems of synchronising state with views, along with reinventing component functions and some kind of declarative way to describe components even in 100% vanilla JS, anyway. Writing basic DOM manipulation boilerplate becomes annoying pretty fast, especially for hybrid render contexts, let alone when you want to change some logic.

    • @rickstrafy4870
      @rickstrafy4870 10 місяців тому

      Nette Framework is the way :)

    • @shugyosha7924
      @shugyosha7924 22 дні тому

      Nah, any time you want to write an algorithm or calculation etc it's going to be vanilla PHP with some Laravel stuff thrown in where necessary.

  • @fcolecumberri
    @fcolecumberri Рік тому +116

    I can feel how Prime wants to do a serious project on Laravel.

    • @SXsoft99
      @SXsoft99 Рік тому

      wait until he reads about Livewire and compares it to htmx

    • @Nekoeye
      @Nekoeye Рік тому +12

      He's laying the groundwork, a good move to avoid unnecessary criticism from individuals who haven't touched PHP in decades but still feel compelled to comment and assert their relevance.

    • @JeremyAndersonBoise
      @JeremyAndersonBoise Рік тому +9

      PHP isn’t fast like Go or C or Rust, but it is often sufficient, and the tooling is great.

    • @CottidaeSEA
      @CottidaeSEA Рік тому +10

      ​@@JeremyAndersonBoise It's fast enough for most things. Depends more on version and how you do things.

    • @DaviMartins99
      @DaviMartins99 Рік тому +2

      Imagine when Prime finds out about Swoole.

  • @echoptic775
    @echoptic775 Рік тому +27

    If javascript can be used for writing backends, its time that php gets used for making frontends

  • @Kiyuja
    @Kiyuja Рік тому +13

    I became a dev in 2019 and in 2020 we had to use PHP for the first time. Even "back then" we still were corrected that PHP is not that slow thing it gets the rep for. Just like Java and C# there were plenty of perf optimizations over the years. Now I personally cannot prove it but I trust the people who told me. Also the project we did ran pretty flawless under PHP. Tho I never really got involved with PHP again :D

    • @blubblurb
      @blubblurb Рік тому +1

      It is by far slower than other languages. But it usually doesn't matter as the bottleneck isn't PHP but other things like the DB. Also it really depends on what you do. If you create the next whatsapp which will be used by billions of people, PHP is probably not the right choice. If you make some Business Solution for some thousands of users I would say, why not.

    • @OzzyTheGiant
      @OzzyTheGiant Рік тому +3

      It's slower than most languagues, but I would argue that it's the fastest of the interpreted ones (PHP, Python, JS, Ruby), at least for raw performance. For async stuff, JS still holds the edge. Multithreading though, not sure.

  • @j.p.9669
    @j.p.9669 Рік тому +11

    Sounds like the deep clone is for updating immutability. So you can change, dump the old object, and move forward with the new.

  • @Dantee52
    @Dantee52 Рік тому +10

    PHP is really great for small to medium projects...even big projects if you configure it well...Also Laravel + InertiaJS is a gamechanger...And for those who say PHP is slow, how many users do you have?

    • @trentirvin2008
      @trentirvin2008 Рік тому

      Just as a noob, what makes a language ideal for large projects as opposed to medium/small projects? Is it just in the case of avoiding bugs in a language like java where things are really verbose and harder to write errors in?

    • @ra2enjoyer708
      @ra2enjoyer708 11 місяців тому

      @@trentirvin2008 The easiness to slap static analysis on (so you could catch basic errors even before building the code) and the amount of legacy interfaces you have to interact with. Java is more about having a compiler without memory wrangling of C/C++, rather than boilerplate. All three relevant dynamic languages: Python, Javascript and PHP have promoted pretty nasty practices in the past and left a lot of legacy unworkable code around (and even some built-in interfaces lingering to this day) thanks to the lack of static analysis tools.

    • @airaction6423
      @airaction6423 2 місяці тому

      ​@@ra2enjoyer708I still use non static typed languages for all my projects. In 20 years of programming I never saw python or php misuse a variable because of dynamic typing and if an interface is documented I explicitly cast the type. I leave static analysis and industry standards to philosophers that don't have to program for a living

  • @robmies3257
    @robmies3257 11 місяців тому +1

    Really love your content. Although I have to play it at half speed at times, to understand what you are saying (or play it more than once :) ). Keep up the great work!

  • @zebraforceone
    @zebraforceone Рік тому +9

    One reason I can think of for doing this is cloning ORM models and you want to clone the table row but change the ID on the model internally. This way you don't have to move data between the database and the API server.

    • @NphiniT
      @NphiniT Рік тому

      I was thinking the same

    • @MarisaClardy
      @MarisaClardy 8 місяців тому

      It really is just a solution to the always-pass-objects-by-reference problem. A cloned object that had other objects as properties would contain references to the original objects rather than new copies. So in PHP world, this was handled via "deep cloning", i.e., in the __clone method, you clone your objects as well. But that wasn't possible on readonly classes/properties until 8.3

  • @connorskudlarek8598
    @connorskudlarek8598 Рік тому +1

    The deep clone of read only seems like a way to ensure that your clone does not reference a read only property. It makes a whole new one, and since it's wholly new you can alter the field before it's actually instantiated with read only.
    If you deep cloned an object with 12 properties, 3 of them are nested read only objects, and one of those read only objects has a value that needs to change-that's where the new feature helps. Since you're only altering one of the nested objects, it can reference the ones that aren't changed and make a new object for the ones that do change.
    I imagine having a user update their information, but wanting to ensure that it doesn't accidentally get updated elsewhere, is a use case. But I'm a noob and have no idea.

  • @svndays
    @svndays Рік тому +9

    Laravel developer experience is way better than rolling your own thing with node, go or python. It's crazy how much more you can get done in the same amount of time.

    • @FunctionGermany
      @FunctionGermany Рік тому +7

      i disagree. the DX can be pretty bad due to magic/generated methods, e.g. on VSCode. i've only seen PHPstorm handle that decently well.
      meanwhile the DX with tRPC remains unmatched.

    • @spicynoodle7419
      @spicynoodle7419 Рік тому +9

      Laravel is the best framework. These NextJS kids don't even know what they're missing. All the shitty services that they have to pay for that Laravel has built in :0

    • @svndays
      @svndays Рік тому

      ​ @FunctionGermany tRPC is not a framework, you still have to figure out authentication, permission management, configuration, databases, caching, environments and more. PhpStorm handles it well by default and there's a very good paid plugin that fills in the gaps with model properties and auto-generated hints for the rest of the methods. There's also packages that let you add the properties with static types to your models if you want to do that.

    • @marcs9451
      @marcs9451 Рік тому +3

      I completely disagree with the Go part, a dynamic language + framework full of magic will never be as good as a simple and explicit one. Having to write more things is totally worth in the long run

    • @FunctionGermany
      @FunctionGermany Рік тому +1

      @@spicynoodle7419 there's a lot of SaaS nonesense going around in the JS space but you can actually ignore it and build something independent with next.js too. it's just that nobody is talking about it because there's no sponsorship money in a FOSS project.

  • @MarisaClardy
    @MarisaClardy 8 місяців тому

    For the cloning of readonly one, deep cloning could not be done before. For those that don't understand this concept, because PHP passes all objects (i.e., class instances) around by reference, if when cloning, you don't also clone the underlying object and re-assign on the newly formed object, then it will still be pointing to the old one, which means if that is then mutable and mutated, it will essentially mutate it in all clones. In the example provided, the PHP class is mutable, so if you didn't reassign the internal ->php on clone, but then cloned the Foo object and then modified the php version, like in the 8.3 version, then the original Foo object you cloned from has the same value. Now, with the 8.3 example, modifying the $clonesd->php->version does not modify it for $instance->php->version. In 8.2 this wasn't possible.
    I hope that's clear?

  • @Loutistic
    @Loutistic 9 місяців тому +1

    "This person must be working on Windows" got me.

  • @apollolux
    @apollolux Рік тому +1

    Groovy, now all I have to do is make sure that my WordPress clients that I'm unable to manually adjust server settings of due to hosting restrictions that have had their sites working for years don't break due to plugins auto-updating without my knowledge before I get a chance to vet them, or worse - plugins that haven't been updated for a while but are still useful suddenly being considered unusable due to newly deprecated PHP functionality that either I'll have to wait for updates, find alternatives for, or hack in the updates myself.

  • @Baby4Ghost
    @Baby4Ghost Рік тому +3

    PHP uses '\' (backspace) as namespace delimiter because '.' (dot) is already used for string concatenation..
    I remember this clearly when it got introduced, because that was the drop that filled my bucket and made me abandon PHP. But traits and the new stuff looks damn tempting...

  • @CottidaeSEA
    @CottidaeSEA Рік тому +4

    I work with PHP regularly, it's usually a pretty nice experience as long as I'm just building new stuff. Delving into the old stuff is usually painful, but that has more to do with the overall architecture and loads of ugly fixes that you need to keep in mind 10 files away in order to not break shit. That along with an overall reluctance of using classes for loads of things, meaning you have documentation which says "returned array has these keys" but does in fact not have those keys.

  • @j-wenning
    @j-wenning Рік тому +1

    The short-term mutability of a deep-cloned, readonly object seems really nice. In JS you'd have to do something like
    > const x = { ...data, nested: { ...data.nested, foo: 123 } };
    whereas Elixir would have something like
    > x = put_in(data, [:nested, :foo], 123)
    So this seems pretty similar to the latter. Looks neat.

  • @XzenTorXz
    @XzenTorXz Рік тому +3

    Python has just added the override feature as well. I think this feature has been overlooked for too long and is mandatory for OOP.

  • @Necessarius
    @Necessarius Рік тому +21

    PHP has grown up, but not everyone’s programming skills have kept pace. Let’s give credit where it’s due: PHP's not the problem, it's waiting for some programmers to catch up!
    But they still keep hating lmao

    • @FunctionGermany
      @FunctionGermany Рік тому +9

      PHP hasn't been the problem since v7 i'd say. however, PHP suffers heavily from what i call the PHP-bootstrap-jQuery-syndrome which is when a technology is so accessible that it attracts many inexperienced and untrained developers, resulting in the majority of code written with that technology being very low quality, therefore giving that technology a bad name.

    • @fnfal113
      @fnfal113 Рік тому +4

      @@FunctionGermany Then AI trains on shit code written by humans, we are doomed.

    • @FunctionGermany
      @FunctionGermany Рік тому +6

      @@fnfal113 yeah 😔. stupid devs using GPT to write code from 2008 stackoverflow that got 1 upvote (the author).

    • @P8860
      @P8860 Рік тому

      @@FunctionGermany ouch! I feel attacked but painfully true

    • @FunctionGermany
      @FunctionGermany Рік тому +1

      @@P8860 don't feel attack. there must be technologies that a lot of junior devs use, otherwise we'd have a lot less software developers today.
      pretty much all developers need to write a lot of bad code as a byproduct before they can make anything good.

  • @webdevnoob
    @webdevnoob Рік тому +4

    Bro, PHP namespaces has been around since v5.3 I think, that's like some 15 years ago. Those slashes has meaning in auto loading classes via Composer.
    I think your idea of PHP as "garbage" is extremely outdated. Seems to me your idea of PHP is still in the v4 era -- where PHP was ironically king because everything else actually suck.
    Now I've no hate for Laravel but even that doesn't represent how really different and good PHP is now. Just plain PHP + PSR + Composer libraries cuts it on its own.
    If you really want to use a framework, Symfony is a good choice -- less magical and closer to native PHP.
    You have to try modern PHP and you'll see, but don't just go blindly and write in procedural PHP 4 like you used to. At least read on PHP The Right Way and you're good to go.

  • @donwinston
    @donwinston Рік тому +1

    PHP has come a long way in the last fifteen years.

  • @fnfal113
    @fnfal113 Рік тому +3

    When laravel does most of the stuffs without causing you pain that react server components is trying to instill.

  • @kristun216
    @kristun216 Рік тому +2

    Deep cloning works great for date classes

  • @KyleHarrisonRedacted
    @KyleHarrisonRedacted Рік тому +8

    5:47 as someone who has written PHP near daily since the ye ol' PHP3 days.. I don't get the deep cloning situation. I can't even think of a scenario where I'd find myself in where that'd be a useful or even desirable thing to do

    • @BillLambert
      @BillLambert Рік тому +1

      I'm guessing it's an optimization for things like PSR-7 objects, which are meant to be immutable so every time you mutate one, it hands you back a brand new object with cloned data instead.

  • @DerIche
    @DerIche Рік тому +3

    finally one video about not hating php

  • @DarkStoorM_
    @DarkStoorM_ Рік тому +2

    Damn, the chat trying to figure out what a Fully Qualified Name is

  • @barneylaurance1865
    @barneylaurance1865 Рік тому

    I've understood the example for deep cloning magic properties now. Yes the final line on the 8.3 side is outside the magic clone method. But that's not where the fatal error is. The fatal error in 8.2 happens on the last line on the left, where `clone` invokes the Foo::__clone method.
    And clone is needed because although Foo is readonly, the PHP class is not readonly, and has a mutable property. So when making a clone of the Foo object we want a deep clone, that has its own instance of PHP, instead of sharing the instance with the original object.
    It's a confusing example with an immutable object that contains a reference to a mutable object.

  • @patricknelson
    @patricknelson Рік тому

    5:51 - That exists since if you have a read-only property on a class (like “Foo” in this case) that you want to clone, you can’t do a _deep clone_ because that property cannot be updated to be cloned as well (hence the “deep” clone of the lower down references). This update fixes that I guess.

  • @xcrap
    @xcrap Рік тому +2

    PHP + HTMX, you may enjoy it.

  • @br3nto
    @br3nto Рік тому

    7:19 the had a better namespace separator when they first introduced the concept, but then they changed it to a / at the last. I think the separator was ::, which is used to access static members.

  • @Jollyprez
    @Jollyprez 5 місяців тому

    The syntax for class virtual functions is absolutely horrific. Objective-C enthusiasts will love it.

  • @mldy1
    @mldy1 Рік тому +2

    they didnt do a major version bump presumably because it is backwards compatible

  • @MattDog_222
    @MattDog_222 Рік тому +3

    how could you overlook the new mb_str_pad()

  • @tolluset
    @tolluset Рік тому +6

    "use php"

  • @redpillsatori3020
    @redpillsatori3020 Рік тому +4

    I just hate how so many PHP sites have `index.php` at the end of URL. I always thought that it was tacky.

    • @FunctionGermany
      @FunctionGermany Рік тому +1

      it's "more accurate" and requires less config on the web server.

    • @javierflores09
      @javierflores09 Рік тому +4

      You can remove that in literal seconds but people just don't bother

    • @SXsoft99
      @SXsoft99 Рік тому +1

      i think it's more related to SEO indexes for old websites because people don't want to know how to forward google bots

  • @user1234-iu1jg
    @user1234-iu1jg Рік тому +347

    PHP > JavaScript.

  • @Gohealt
    @Gohealt Рік тому +11

    Prime, you are the best thing that happened to youtube, after youtube itself :)

  • @Kiba114
    @Kiba114 Рік тому +2

    php is a must for web

  • @daltonyon
    @daltonyon Рік тому +1

    You should do Advent of Code in PHP hahaha
    I think that has been more than 3 years working with PHP, and it isn't so bad like I did think

  • @johanneswelsch
    @johanneswelsch Рік тому

    This is the reason the only language I like is Go. It don't like when new features are introduced every week. I like having one way of doing things.

  • @daved3464
    @daved3464 Рік тому

    PHP always passes objects by reference so cloning an object with a readonly object property will have the cloned object have an readonly object property referencing the same readonly object as the previous one. So by making a clone of the readonly object property in the magic __clone method prevent the side effects of modifying something in the readonly property and making the program go funny (that being the same referenced object in both the original and cloned instance)

  • @MrWerminghoff
    @MrWerminghoff Рік тому +2

    feels illegal to be here so soon

  • @loek8638
    @loek8638 Рік тому +4

    Bro, php has match operators and js still don't

  • @rafagd
    @rafagd Рік тому

    3:45 - In PHP, everything is copy-on-write references, if passed "by value". There's no syntax to get a reference, what you can do is force the creation of aliases that act as references [using the =& operator]. You can also declare a parameter as "receiving a reference", which is actually pretty bad, because the user never knows their variable could potentially be used as a output parameter, so it is better avoided.
    eg: you can function abc(&$var) { $var = 0; }, when you call it abc($input), input will become 0 even if you never expected it to be a reference pass.
    For the clone, readonly props can only be modified inside the constructor. That change makes it possible for you to reinitialize readonly stuff after a clone, if necessary. Not sure I like it, but that's what it is.

    • @GreyDeathVaccine
      @GreyDeathVaccine Рік тому

      Objects are passed by reference. If you care so much why not use simple stdClass object and assign your data to it? 🙂

    • @barneylaurance1865
      @barneylaurance1865 Рік тому +1

      @@GreyDeathVaccine Objects are not passed by reference. Objects are not passed at all. References to objects are passed by value.

    • @rafagd
      @rafagd Рік тому

      ​@@GreyDeathVaccine I have no problems with passing stuff by reference, my problem is when you're passing an argument that you don't expect to become magically a reference, say an integer, and the function changes that argument to whatever crazy stuff it wants to change it to. Usually not a problem with std api, but users are crazy.
      In PHP you also have 0 visibility over what parameters are going to be by-reference and what parameters are going to be by-value, from the function user side.
      Also, since php tends to be copy-on-write everything, there's usually not a whole lot of stuff that you actually want to pass by-reference anyway...

    • @rafagd
      @rafagd Рік тому

      @@barneylaurance1865 Exactly! Assume you have 2 functions:
      function a($v) { $v->foo = 0; }
      function b(&$v) { $v = 0; }
      Then you have a value:
      $c = new Something.
      if I call a($c), I wouldn't be surprised by something changing inside it, but $c itself is still the reference to that obj. Now if I call b($c), it's a footgun that has just destroyed any hopes that I can debug this shit in less than a day.
      $c isn't the reference anymore, $c is something else entirely. It's passing a reference as a reference and the user of the function has NO IDEA that that happened.

    • @barneylaurance1865
      @barneylaurance1865 Рік тому +1

      Isn't it just arrays that do copy-on-write? I thought the other primitives were just copied directly.

  • @stilldreamy5181
    @stilldreamy5181 Рік тому

    I think they put too much emphasis on being able to deep clone readonly properties with that explanation. I think the bigger deal is being able to modify cloned, readonly properties period, not necessarily for the purpose of deep cloning them. Otherwise the cloned object can never have different values for the readonly properties. I think this is a good stepping stone to further improvements in the future if they add something like `clone with` where you specify which properties of the clone should have new/different values. You can do something similar in Kotlin and Scala 3. It's great for making immutable classes because if everything is immutable, how do you change anything? Well you don't change the object, you clone it with differences. Currently you basically have to duplicate the constructor in a hand rolled cloneWith() method for every single class you make.

  • @luigibattaglioli6026
    @luigibattaglioli6026 Рік тому +3

    Everyone hating on PHP has obviously never built anything with Laravel and they don’t know what they’re missing out on 😔 best developer experience and community I’ve ever experienced.

    • @RomvnlyPlays
      @RomvnlyPlays Рік тому

      @ctxz9580you are but a novice - unable to understand beauty & grace

    • @ojsojs6004
      @ojsojs6004 11 місяців тому

      ​@ctxz9580 you don't understand what you are doing.

  • @stilldreamy5181
    @stilldreamy5181 Рік тому +3

    Php is getting better. For people already using php, all these improvements are very nice to get. But php will always be worse than a nice, well designed, statically typed, compiled language. Comparing PHPStan or Psalm to a real compiler and the way it reports issues is night and day. Php static analyzers are not part of the language, they are these tacked on things made by the community, and therefore will never be as nice as a compiler that is required and part of the language. Also, php is overly verbose. `readonly`, arrows just to call a method, a dollar sign before every variable. Those might seem like small things, but it all adds up. Compare it to a language like Scala 3 where it is both terse and expressive/readable at the same time.

  • @shugyosha7924
    @shugyosha7924 22 дні тому

    I like PHP, especially now that Laravel makes it so easy to do stuff.

  • @AScribblingTurtle
    @AScribblingTurtle Рік тому

    2:30 : Backslash is the separator for namespaces. Similar to how a "." would be on a Node package name.
    3:08 : Not a huge fan of the #[\Override] annotation but It would make maintaining stuff probably a bit easier.
    I don't understand why we couldn't just have a PHPDoc @override comment instead. That whay The Language Server could do the same checks. By using an annotation, PHP now has to check this stuff, whenever it loads a script.

    • @ivanjelenic5627
      @ivanjelenic5627 Рік тому

      There were discussions when it was being added. Iirc they didn't use @ because that's the operator for error message supression

    • @AScribblingTurtle
      @AScribblingTurtle Рік тому

      ​@@ivanjelenic5627 The Problem I see here, is, that it uses the # symbol, which does make it a comment already.
      But it is a comment, that is now executed / evaluated at runtime instead of just during writting in the IDE.
      With PHPDoc it would be something like /** @overrides [propertyname] */

  • @marble_wraith
    @marble_wraith Рік тому

    PHP didn't used to break backwards, which was the problem with the language for a long time. There'd be old stuff they'd mark as "deprecated" but people would still use it.
    Now they brokeback... 😏

    • @barneylaurance1865
      @barneylaurance1865 Рік тому

      They try to keep most of the BC breaks for the x.0 major releases, i.e. they're saving up thing to break in 9.0. But there are always a few BC breaks in the x.y releases like this year's.

  • @enkiimuto1041
    @enkiimuto1041 Рік тому

    Honestly, I decided to try Symfony and... it was a text wall just for some basic posting... meanwhile in Django it was like 9 lines. Not worth it.

  • @LuizGustavoAgostinho
    @LuizGustavoAgostinho Рік тому +4

    PHPagen 😀

  • @mvargasmoran
    @mvargasmoran Рік тому

    Hell yeah! I'm not going back tho.

  • @keithprinkey8575
    @keithprinkey8575 7 місяців тому +1

    PHP is badass. I have made several applications using PHP and laravel and they are beautiful, fast websites. PHP is awesome but can be slower than JS. If you use a redis DB for sessions and caches, your php laravel site doubles in speed. Using a garbage collector makes it even faster!

  • @Zach-s5g
    @Zach-s5g 10 місяців тому

    maybe the clone method is useful for reflection class? or for testcases?

  • @judedavis92
    @judedavis92 Рік тому +1

    Im getting a lambo now

  • @mt1104uk
    @mt1104uk Рік тому +1

    Have they fixed the docs yet so you don't have to read comment 15 to find out the function does something random you need to be aware of.

  • @kriffos
    @kriffos Рік тому +4

    Backward compatibility breaks in minor versions is stupid, they should just follow good old .. version scheme. I like the new features PHP is getting, but they should really wipe out the inconsistency in the language, that would be a great breaking change worth another major version.

    • @FunctionGermany
      @FunctionGermany Рік тому +2

      some projects have their reasons for not following semver.
      maybe regular, smaller breaking changes motivates more teams to update in comparison to major breaking updates which creates demand for supporting the old version or LTS versions.

    • @marcs9451
      @marcs9451 Рік тому +1

      pho was created before SemVer was popular.

    • @kriffos
      @kriffos Рік тому

      @@marcs9451 that's not true at all. SemVer is a relatively new term but the general procedure is really old.

    • @SXsoft99
      @SXsoft99 Рік тому

      they only removed some inconsistencies that devs should have stayed away anyway

    • @kriffos
      @kriffos Рік тому

      @@SXsoft99 sure, that may be the case. To avoid having to know such internals, e.g. as an administrator, it is nice to follow the versioning rules. After all, that's the whole point.

  • @kevinyardie9135
    @kevinyardie9135 Рік тому +2

    Jamaica 🇯🇲 in the building love your videos bro

  • @32zim32
    @32zim32 Рік тому +1

    In my test php swoole was faster then go in typical microservices scenario, surprise

  • @oldcastor-
    @oldcastor- Рік тому +1

    not really most pushing forward release lol not a single example of performance, but in general php8+ going good

  • @deniskoronets
    @deniskoronets 2 місяці тому

    I'm still waiting PHP to get rid of str_replace and all legacy shit functions. Also it really needs pseudo-objects when work with scalars

  • @AdmiralSnackbarz
    @AdmiralSnackbarz Рік тому +3

    Will the Primagen switch to PHP after this update?

  • @EngineerNick
    @EngineerNick Рік тому

    if they remove the dollar sign from variable names i'll look at it

  • @necastiv11
    @necastiv11 10 місяців тому

    PHP namespaces resembles the folder structure of the file. Why they use \ \ \, its because you can have 2 functions with same name but different namespace. So you can import both functions but just point to right namespaces. You than need to use as word to rename inports from namespace.. bla bla

  • @zeocamo
    @zeocamo Рік тому

    the \ is for namespaces

  • @MichaelAbramo
    @MichaelAbramo 11 місяців тому

    If you have to put a dollar sign before every variable name, you've already lost.

  • @matteobortolazzo
    @matteobortolazzo Рік тому

    Will you give a chance to C# 12 with .NET 8 and AOT? (F# is still ahead on features)

  • @PbPomper
    @PbPomper 6 місяців тому

    So __clone is like the init property in C#?

  • @kippie80
    @kippie80 Рік тому

    I'd used PHP lots back in 2000, I'd stopped using awk grep, etc. in command line tools! But nah, I'm sorry, not interested. And yes, I still use good'ol bash. Never need awk as much as used to though ... funny that. I suppose data system integrations are better.

  • @sevilnatas
    @sevilnatas Рік тому

    You clone the const to a new instance, change its value and then it is locked as the const that it is? You get one free change of value at time of cloning, and then that's it, locked?

  • @semyaza555
    @semyaza555 Рік тому +2

    1:33 Lmfao

  • @MadalinIgnisca
    @MadalinIgnisca 9 місяців тому

    Would you make a review on openswoole on php?

  • @Stoney_Eagle
    @Stoney_Eagle Рік тому

    You say you wouldn't hate Laravel, I say you'd like it.

  • @gogogomes7025
    @gogogomes7025 Рік тому +2

    What's next, Perl 6?

  • @roccociccone597
    @roccociccone597 9 місяців тому

    I used to hate PHP but I'll be very honest, I'd rather make a new application with PHP 8.3 than with node or even python.

  • @CrichtonAda-j1p
    @CrichtonAda-j1p Місяць тому

    Rogahn Cliff

  • @monstercameron
    @monstercameron Рік тому +1

    this looks messier than rust code

  • @TheBlackmanIsGod
    @TheBlackmanIsGod Рік тому

    Been trying to learn PHP since PHP 5, now was trying to learn PHP8, now it’s gone to PHP 8.3 before I could get used to PHP8……. The tech is coming out and updates are so fast nowadays how can anyone keep up?!?!?

    • @wolizuka
      @wolizuka Рік тому +1

      By sticking to the technologies you chose for a project for as long as it's reasonable to do so, and not changing the minute a new version/framework comes out.
      I don't think PHP8 is irrelevant just because 8.3 came out.

    • @TheBlackmanIsGod
      @TheBlackmanIsGod Рік тому

      @@wolizuka nobody is looking for someone hood in PHP 5, when PHP 8.3 is out…. Same with PHP 8…. As new tech comes out that’s what these jobs want to hire people who have mastered the newest tech

    • @SXsoft99
      @SXsoft99 Рік тому

      5.6 28-Aug-14
      7 3 December 2015
      7.1 01 December 2016
      7.2 30 November 2017
      7.3 6 December 2018
      7.4 28 November 2019
      8 26 November 2020
      8.1 25 November 2021
      8.2 8 December 2022
      8.3 23 November 2023
      how were you not able to keep up? one year is enough to check what's new and refactor the code

    • @javierflores09
      @javierflores09 Рік тому +1

      ​@@TheBlackmanIsGod that's just not true? a hefty amount of jobs orbit around maintaining existing code, which is often a few if not several versions behind whatever is the latest thing. As long as there are no security fixes which haven't been backported, there's virtually no reason to update other than improved DX when it comes to established languages.
      All of that said, it is quite the exaggeration to say "how can anyone keep up" when few things have been actually added, none of these changes have been paradigm--shifting or anything of the sort and in reality there hasn't been any fundamental changes to the language so if you know PHP 5, you're 95% of the way there to PHP 8

    • @EdmondDantèsDE
      @EdmondDantèsDE Рік тому

      Nonsense. First of all 99% of the language remains the same.
      Second of all you don't need to know everything, just know it exists and look it up when you need it.

  • @TheKomaras
    @TheKomaras Рік тому +1

    Would be nice to see you go through Laravel :)

  • @Oprekode
    @Oprekode 7 місяців тому

    am still use php 7.4

  • @Im_Ninooo
    @Im_Ninooo Рік тому

    nah, thanks I'll stick with Go.

  • @jjones503
    @jjones503 Рік тому +2

    PHP has always been the best language. Change my mind.

  • @JLarky
    @JLarky Рік тому

    I like how this video started with "I think PHP is trying to become a real language now" and the whole video is "what the hell is this garbage?" 😂

  • @aliendroid8174
    @aliendroid8174 Рік тому

    I don't know if it applies to php as well but in c++ you might want to deep copy a const ref if you want to ensure your copy isn't changed by the source since it might be a non const passed as a const. It could also be the you want to store it in a specific location

  • @victoriabirch8660
    @victoriabirch8660 Місяць тому

    Ezekiel Pine

  • @fldgr
    @fldgr Рік тому +7

    I thought it said 3 days ago - but it was 3 minutes ago.
    Anyways PHP is the one true superior language.

    • @martinhotmann7868
      @martinhotmann7868 Рік тому +1

      Sorry just not superior in anything..
      If you disagree, name in what it is superior to everything else.

    • @hitthemill8595
      @hitthemill8595 Рік тому +1

      @@martinhotmann7868being bad

    • @martinhotmann7868
      @martinhotmann7868 Рік тому

      @@hitthemill8595 True that ^^

    • @javierflores09
      @javierflores09 Рік тому +1

      @@martinhotmann7868 superior ecosystem. You can't go wrong with Laravel but if you feel like something different there's also Symfony, that's kinda about it for the majority of devs. You don't have to play catch-up with every other framework trying to reinvent the wheel, or completely changing paradigms between versions

  • @joshuasy10
    @joshuasy10 Рік тому

    Strike me down with all of your hatred, and your journey towards the dark side will be complete!

  • @pretendlovers
    @pretendlovers Рік тому

    i love you prime, youre my goat

  • @timurrte5694
    @timurrte5694 10 місяців тому +2

    Just accept that PHP is better in any way than JavaScript

  • @peehi2
    @peehi2 Рік тому

    WEN LARAGEN

  • @ever-modern
    @ever-modern Рік тому +2

    Prime's attempts make me wonder how much he makes off of sifting through this crap. Would take a lot to make me do the same.

  • @DorothyJackson-g7c
    @DorothyJackson-g7c 2 місяці тому

    Janice Haven

  • @soniablanche5672
    @soniablanche5672 Рік тому +1

    PHP was never backward compatible and that's why it's a pain in the ass to update Laravel projects, which in itself isn't 100% backward compatible either lol.

  • @cleverengineer2410
    @cleverengineer2410 Рік тому

    I don't like PHP and I think it's trash however if I had a project that required the most I would just use it.

  • @sketchionic6356
    @sketchionic6356 Місяць тому

    When he said the programmer is a windows users because of the above PSR compliant imports, I knew he knows nothing about php.