PHP 8 3 Released

Sdílet
Vložit
  • čas přidán 26. 11. 2023
  • Recorded live on twitch, GET IN
    / theprimeagen
    PHP article: www.php.net/releases/8.3/en.php
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagenreact
    Kinesis Advantage 360: bit.ly/Prime-Kinesis
    Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
    turso.tech/deeznuts
  • Věda a technologie

Komentáře • 333

  • @steveaguay
    @steveaguay Před 6 měsíci +96

    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 Před 6 měsíci +65

      PHP pays my bills just fine :)

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před 6 měsíci +127

      i want to try laravel

    • @soroushjm1011
      @soroushjm1011 Před 6 měsíci

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

    • @danielvigh8211
      @danielvigh8211 Před 6 měsíci +8

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

    • @barneylaurance1865
      @barneylaurance1865 Před 6 měsíci +13

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

  • @Taverius
    @Taverius Před 6 měsíci +268

    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 Před 6 měsíci +27

      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 Před 6 měsíci +23

      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 Před 6 měsíci +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 Před 6 měsíci +5

      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 Před 6 měsíci +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)

  • @fus-ro-dah
    @fus-ro-dah Před 6 měsíci +80

    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 Před 6 měsíci +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 Před 6 měsíci +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 Před 6 měsíci

      @@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 Před 6 měsíci +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 Před 6 měsíci

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

  • @justjess5891
    @justjess5891 Před 6 měsíci +48

    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 Před 6 měsíci +8

      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 Před 6 měsíci +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 Před 6 měsíci

      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 Před 5 měsíci

      Nette Framework is the way :)

  • @roelhemerik5715
    @roelhemerik5715 Před 6 měsíci +23

    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 Před 6 měsíci +57

    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 Před 6 měsíci

      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 Před 6 měsíci +4

      They went LaTeX mode

    • @dzhukov
      @dzhukov Před 6 měsíci +10

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

    • @mme725
      @mme725 Před 6 měsíci +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 Před 6 měsíci

      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)

  • @fcolecumberri
    @fcolecumberri Před 6 měsíci +111

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

    • @SXsoft99
      @SXsoft99 Před 6 měsíci

      wait until he reads about Livewire and compares it to htmx

    • @Nekoeye
      @Nekoeye Před 6 měsíci +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 Před 6 měsíci +9

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

    • @CottidaeSEA
      @CottidaeSEA Před 6 měsíci +10

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

    • @DaviMartins99
      @DaviMartins99 Před 6 měsíci +2

      Imagine when Prime finds out about Swoole.

  • @Kiyuja
    @Kiyuja Před 6 měsíci +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 Před 6 měsíci +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 Před 6 měsíci +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 Před 6 měsíci +11

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

  • @echoptic775
    @echoptic775 Před 6 měsíci +20

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

  • @robmies3257
    @robmies3257 Před 5 měsíci

    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 Před 6 měsíci +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 Před 6 měsíci

      I was thinking the same

    • @MarisaClardy
      @MarisaClardy Před 3 měsíci

      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 Před 6 měsíci

    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.

  • @Dantee52
    @Dantee52 Před 6 měsíci +7

    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 Před 6 měsíci

      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 Před 6 měsíci

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

  • @j-wenning
    @j-wenning Před 6 měsíci +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.

  • @br3nto
    @br3nto Před 6 měsíci

    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.

  • @patricknelson
    @patricknelson Před 6 měsíci

    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.

  • @matteobortolazzo
    @matteobortolazzo Před 6 měsíci

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

  • @apollolux
    @apollolux Před 6 měsíci +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.

  • @MattDog_222
    @MattDog_222 Před 6 měsíci +3

    how could you overlook the new mb_str_pad()

  • @MarisaClardy
    @MarisaClardy Před 3 měsíci

    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?

  • @barneylaurance1865
    @barneylaurance1865 Před 6 měsíci

    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.

  • @XzenTorXz
    @XzenTorXz Před 6 měsíci +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.

  • @donwinston
    @donwinston Před 6 měsíci +1

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

  • @kristun216
    @kristun216 Před 6 měsíci +2

    Deep cloning works great for date classes

  • @KyleHarrisonRedacted
    @KyleHarrisonRedacted Před 6 měsíci +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 Před 6 měsíci +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.

  • @tolluset
    @tolluset Před 6 měsíci +6

    "use php"

  • @svndays
    @svndays Před 6 měsíci +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 Před 6 měsíci +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 Před 6 měsíci +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 Před 6 měsíci

      ​ @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 Před 6 měsíci +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 Před 6 měsíci +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.

  • @roy1299
    @roy1299 Před 5 měsíci

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

  • @DarkStoorM_
    @DarkStoorM_ Před 6 měsíci +2

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

  • @mt1104uk
    @mt1104uk Před 6 měsíci +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.

  • @Baby4Ghost
    @Baby4Ghost Před 6 měsíci +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...

  • @mldy1
    @mldy1 Před 6 měsíci +2

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

  • @MrWerminghoff
    @MrWerminghoff Před 6 měsíci +2

    feels illegal to be here so soon

  • @loek8638
    @loek8638 Před 6 měsíci +4

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

  • @daltonyon
    @daltonyon Před 6 měsíci +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

  • @stilldreamy5181
    @stilldreamy5181 Před 6 měsíci

    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.

  • @MadalinIgnisca
    @MadalinIgnisca Před 4 měsíci

    Would you make a review on openswoole on php?

  • @sevilnatas
    @sevilnatas Před 6 měsíci

    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?

  • @Jollyprez
    @Jollyprez Před 15 dny

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

  • @keyboard_g
    @keyboard_g Před 6 měsíci

    Change only once readony properties are supporting init only properties from within clone?

  • @fnfal113
    @fnfal113 Před 6 měsíci +3

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

  • @xcrap
    @xcrap Před 6 měsíci +2

    PHP + HTMX, you may enjoy it.

  • @CottidaeSEA
    @CottidaeSEA Před 6 měsíci +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.

  • @PbPomper
    @PbPomper Před měsícem

    So __clone is like the init property in C#?

  • @user-ir3yw8bs4i
    @user-ir3yw8bs4i Před 6 měsíci +11

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

  • @Kiba114
    @Kiba114 Před 6 měsíci +2

    php is a must for web

  • @Loutistic
    @Loutistic Před 3 měsíci

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

  • @mvargasmoran
    @mvargasmoran Před 6 měsíci

    Hell yeah! I'm not going back tho.

  • @user1234-iu1jg
    @user1234-iu1jg Před 6 měsíci +313

    PHP > JavaScript.

  • @DerIche
    @DerIche Před 6 měsíci +3

    finally one video about not hating php

  • @judedavis92
    @judedavis92 Před 6 měsíci +1

    Im getting a lambo now

  • @AdmiralSnackbarz
    @AdmiralSnackbarz Před 6 měsíci +3

    Will the Primagen switch to PHP after this update?

  • @rafagd
    @rafagd Před 6 měsíci

    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 Před 6 měsíci

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

    • @barneylaurance1865
      @barneylaurance1865 Před 6 měsíci +1

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

    • @rafagd
      @rafagd Před 6 měsíci

      ​@@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 Před 6 měsíci

      @@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 Před 6 měsíci +1

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

  • @Rahul79821
    @Rahul79821 Před 6 měsíci +3

    Those back slashes are php thing irrespective of OS.

  • @daved3464
    @daved3464 Před 6 měsíci

    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)

  • @redpillsatori3020
    @redpillsatori3020 Před 6 měsíci +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 Před 6 měsíci +1

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

    • @javierflores09
      @javierflores09 Před 6 měsíci +4

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

    • @SXsoft99
      @SXsoft99 Před 6 měsíci +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

  • @LuizGustavoAgostinho
    @LuizGustavoAgostinho Před 6 měsíci +4

    PHPagen 😀

  • @jjones503
    @jjones503 Před 6 měsíci +2

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

  • @enkiimuto1041
    @enkiimuto1041 Před 6 měsíci

    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.

  • @AScribblingTurtle
    @AScribblingTurtle Před 6 měsíci

    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 Před 6 měsíci

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

    • @AScribblingTurtle
      @AScribblingTurtle Před 6 měsíci

      ​@@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] */

  • @zeocamo
    @zeocamo Před 6 měsíci

    the \ is for namespaces

  • @aliendroid8174
    @aliendroid8174 Před 6 měsíci

    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

  • @Necessarius
    @Necessarius Před 6 měsíci +16

    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 Před 6 měsíci +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 Před 6 měsíci +4

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

    • @FunctionGermany
      @FunctionGermany Před 6 měsíci +6

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

    • @P8860
      @P8860 Před 6 měsíci

      @@FunctionGermany ouch! I feel attacked but painfully true

    • @FunctionGermany
      @FunctionGermany Před 6 měsíci +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.

  • @johanneswelsch
    @johanneswelsch Před 6 měsíci

    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.

  • @webdevnoob
    @webdevnoob Před 6 měsíci +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.

  • @32zim32
    @32zim32 Před 6 měsíci +1

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

  • @kevinyardie9135
    @kevinyardie9135 Před 6 měsíci +2

    Jamaica 🇯🇲 in the building love your videos bro

  • @Oprekode
    @Oprekode Před měsícem

    am still use php 7.4

  • @oldcastor-
    @oldcastor- Před 6 měsíci +1

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

  • @EngineerNick
    @EngineerNick Před 6 měsíci

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

  • @marble_wraith
    @marble_wraith Před 6 měsíci

    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 Před 6 měsíci

      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.

  • @stilldreamy5181
    @stilldreamy5181 Před 6 měsíci +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.

  • @semyaza555
    @semyaza555 Před 6 měsíci +2

    1:33 Lmfao

  • @TheKomaras
    @TheKomaras Před 6 měsíci +1

    Would be nice to see you go through Laravel :)

  • @necastiv11
    @necastiv11 Před 5 měsíci

    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

  • @MichaelAbramo
    @MichaelAbramo Před 6 měsíci

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

  • @peehi2
    @peehi2 Před 6 měsíci

    WEN LARAGEN

  • @kippie80
    @kippie80 Před 6 měsíci

    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.

  • @monstercameron
    @monstercameron Před 6 měsíci +1

    this looks messier than rust code

  • @TariqSajid
    @TariqSajid Před 6 měsíci

    why your videos are not 4k ?

  • @gogogomes7025
    @gogogomes7025 Před 6 měsíci +2

    What's next, Perl 6?

  • @kriffos
    @kriffos Před 6 měsíci +3

    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 Před 6 měsíci +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 Před 6 měsíci +1

      pho was created before SemVer was popular.

    • @kriffos
      @kriffos Před 6 měsíci

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

    • @SXsoft99
      @SXsoft99 Před 6 měsíci

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

    • @kriffos
      @kriffos Před 6 měsíci

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

  • @shogo6
    @shogo6 Před 3 měsíci

    phpagem

  • @charliea6038
    @charliea6038 Před 6 měsíci

    PHP looks like java now

  • @TheBlackmanIsGod
    @TheBlackmanIsGod Před 6 měsíci

    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 Před 6 měsíci +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 Před 6 měsíci

      @@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 Před 6 měsíci

      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 Před 6 měsíci +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

    • @HyperionStudiosDE
      @HyperionStudiosDE Před 6 měsíci

      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.

  • @ManWhoLostTheWar
    @ManWhoLostTheWar Před 6 měsíci

    i love you prime, youre my goat

  • @Stoney_Eagle
    @Stoney_Eagle Před 6 měsíci

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

  • @Im_Ninooo
    @Im_Ninooo Před 6 měsíci

    nah, thanks I'll stick with Go.

  • @JLarky
    @JLarky Před 6 měsíci

    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?" 😂

  • @taylorkoepp3048
    @taylorkoepp3048 Před 6 měsíci +1

    I'm not a PHP man but I would definitely pick a Laravel project over a React project (actually there isn't much I wouldn't pick over a React project).

  • @luigibattaglioli6026
    @luigibattaglioli6026 Před 6 měsíci +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 Před 6 měsíci

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

    • @ojsojs6004
      @ojsojs6004 Před 6 měsíci

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

  • @emceha
    @emceha Před 6 měsíci

    Objective opinions about php? Imposibru

  • @SurenEnfiajyan
    @SurenEnfiajyan Před 6 měsíci

    Those features don't seem very popular. What I really want from a serious typed language, is support of generics.

    • @SXsoft99
      @SXsoft99 Před 6 měsíci

      /**
      * @var Collection $list
      */

    • @CottidaeSEA
      @CottidaeSEA Před 6 měsíci

      That can be achieved in PHP through a build step. Works quite well, but I wouldn't use it in production.

    • @SurenEnfiajyan
      @SurenEnfiajyan Před 6 měsíci

      @@CottidaeSEA You mean something like typescript?

    • @CottidaeSEA
      @CottidaeSEA Před 6 měsíci

      @@SurenEnfiajyan Basically, yes.

  • @ever-modern
    @ever-modern Před 6 měsíci +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.

  • @keithprinkey8575
    @keithprinkey8575 Před 2 měsíci

    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!

  • @joshuasy10
    @joshuasy10 Před 6 měsíci

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

  • @roccociccone597
    @roccociccone597 Před 3 měsíci

    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.

  • @ctoxyz
    @ctoxyz Před 2 měsíci

    #hilarious ++ :)

  • @timurrte5694
    @timurrte5694 Před 4 měsíci

    Just accept that PHP is better in any way than JavaScript