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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
@@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.
@steveaguay Жыл бұрын
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 Жыл бұрын
PHP pays my bills just fine :)
@ThePrimeTimeagen Жыл бұрын
i want to try laravel
@soroushjm1011 Жыл бұрын
@@ThePrimeTimeagenplease try asp for our amusement 😂, we like see you suffer 😂
@danielvigh8211 Жыл бұрын
Please make it into a video or I will send you a lexer in php. Take it as a threath @@ThePrimeTimeagen
@barneylaurance1865 Жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
@@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)
@justjess5891 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
Nette Framework is the way :)
@shugyosha79242 ай бұрын
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.
@mme725 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
They went LaTeX mode
@dzhukov Жыл бұрын
They could not use `.` as a delimiter as well because it is reserved for string concatenation in PHP.
@mme725 Жыл бұрын
@@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 Жыл бұрын
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)
@roelhemerik5715 Жыл бұрын
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.
@fcolecumberri Жыл бұрын
I can feel how Prime wants to do a serious project on Laravel.
@SXsoft99 Жыл бұрын
wait until he reads about Livewire and compares it to htmx
@Nekoeye Жыл бұрын
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 Жыл бұрын
PHP isn’t fast like Go or C or Rust, but it is often sufficient, and the tooling is great.
@CottidaeSEA Жыл бұрын
@@JeremyAndersonBoise It's fast enough for most things. Depends more on version and how you do things.
@DaviMartins99 Жыл бұрын
Imagine when Prime finds out about Swoole.
@echoptic775 Жыл бұрын
If javascript can be used for writing backends, its time that php gets used for making frontends
@FunctionGermany Жыл бұрын
stop
@RedOchsenbein Жыл бұрын
Heck, you can use CSS as a backend language. So, why not. 😀
@Luclecool123 Жыл бұрын
This is so good
@peehi2 Жыл бұрын
PHP is frontend bro . Looks like React nowadays
@ivanjelenic5627 Жыл бұрын
Livewire already kinda does that
@Kiyuja Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
Sounds like the deep clone is for updating immutability. So you can change, dump the old object, and move forward with the new.
@Dantee52 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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.
@airaction64233 ай бұрын
@@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
@connorskudlarek8598 Жыл бұрын
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.
@zebraforceone Жыл бұрын
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 Жыл бұрын
I was thinking the same
@MarisaClardy10 ай бұрын
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
@MattDog_222 Жыл бұрын
how could you overlook the new mb_str_pad()
@robmies3257 Жыл бұрын
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!
@KyleHarrisonRedacted Жыл бұрын
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 Жыл бұрын
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.
@svndays Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@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 Жыл бұрын
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 Жыл бұрын
@@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.
@Loutistic10 ай бұрын
"This person must be working on Windows" got me.
@loek8638 Жыл бұрын
Bro, php has match operators and js still don't
@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.
@donwinston Жыл бұрын
PHP has come a long way in the last fifteen years.
@DarkStoorM_ Жыл бұрын
Damn, the chat trying to figure out what a Fully Qualified Name is
@user1234-iu1jg Жыл бұрын
PHP > JavaScript.
@TheMedjunior Жыл бұрын
Facts
@troffeelituf Жыл бұрын
No.
@kon-jakub Жыл бұрын
why are you geh?
@Necessarius Жыл бұрын
Based
@FunctionGermany Жыл бұрын
typescript though
@mt1104uk Жыл бұрын
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.
@MarisaClardy10 ай бұрын
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?
@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.
@Necessarius Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@FunctionGermany Then AI trains on shit code written by humans, we are doomed.
@FunctionGermany Жыл бұрын
@@fnfal113 yeah 😔. stupid devs using GPT to write code from 2008 stackoverflow that got 1 upvote (the author).
@P8860 Жыл бұрын
@@FunctionGermany ouch! I feel attacked but painfully true
@FunctionGermany Жыл бұрын
@@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.
@kristun216 Жыл бұрын
Deep cloning works great for date classes
@Baby4Ghost Жыл бұрын
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...
@XzenTorXz Жыл бұрын
Python has just added the override feature as well. I think this feature has been overlooked for too long and is mandatory for OOP.
@redpillsatori3020 Жыл бұрын
I just hate how so many PHP sites have `index.php` at the end of URL. I always thought that it was tacky.
@FunctionGermany Жыл бұрын
it's "more accurate" and requires less config on the web server.
@javierflores09 Жыл бұрын
You can remove that in literal seconds but people just don't bother
@SXsoft99 Жыл бұрын
i think it's more related to SEO indexes for old websites because people don't want to know how to forward google bots
@CottidaeSEA Жыл бұрын
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 Жыл бұрын
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.
@mldy1 Жыл бұрын
they didnt do a major version bump presumably because it is backwards compatible
@Zach-s5g Жыл бұрын
maybe the clone method is useful for reflection class? or for testcases?
@DerIche Жыл бұрын
finally one video about not hating php
@apollolux Жыл бұрын
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.
@webdevnoob Жыл бұрын
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.
@PbPomper8 ай бұрын
So __clone is like the init property in C#?
@fnfal113 Жыл бұрын
When laravel does most of the stuffs without causing you pain that react server components is trying to instill.
@MadalinIgnisca11 ай бұрын
Would you make a review on openswoole on php?
@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 Жыл бұрын
Objects are passed by reference. If you care so much why not use simple stdClass object and assign your data to it? 🙂
@barneylaurance1865 Жыл бұрын
@@GreyDeathVaccine Objects are not passed by reference. Objects are not passed at all. References to objects are passed by value.
@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 Жыл бұрын
@@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 Жыл бұрын
Isn't it just arrays that do copy-on-write? I thought the other primitives were just copied directly.
@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.
@AdmiralSnackbarz Жыл бұрын
Will the Primagen switch to PHP after this update?
@xcrap Жыл бұрын
PHP + HTMX, you may enjoy it.
@tolluset Жыл бұрын
"use php"
@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?
@pqp_vc Жыл бұрын
feels illegal to be here so soon
@Gohealt Жыл бұрын
Prime, you are the best thing that happened to youtube, after youtube itself :)
@Jollyprez7 ай бұрын
The syntax for class virtual functions is absolutely horrific. Objective-C enthusiasts will love it.
@Kiba114 Жыл бұрын
php is a must for web
@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 Жыл бұрын
There were discussions when it was being added. Iirc they didn't use @ because that's the operator for error message supression
@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] */
@daltonyon Жыл бұрын
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
@matteobortolazzo Жыл бұрын
Will you give a chance to C# 12 with .NET 8 and AOT? (F# is still ahead on features)
@LuizGustavoAgostinho Жыл бұрын
PHPagen 😀
@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)
@judedavis92 Жыл бұрын
Im getting a lambo now
@gogogomes7025 Жыл бұрын
What's next, Perl 6?
@zeocamo Жыл бұрын
the \ is for namespaces
@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.
@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.
@kriffos Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
pho was created before SemVer was popular.
@kriffos Жыл бұрын
@@marcs9451 that's not true at all. SemVer is a relatively new term but the general procedure is really old.
@SXsoft99 Жыл бұрын
they only removed some inconsistencies that devs should have stayed away anyway
@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.
@TariqSajid Жыл бұрын
why your videos are not 4k ?
@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.
@EngineerNick Жыл бұрын
if they remove the dollar sign from variable names i'll look at it
@theshinyplayer2373 Жыл бұрын
PHP is all about that money.
@stilldreamy5181 Жыл бұрын
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 Жыл бұрын
1:33 Lmfao
@barneylaurance1865 Жыл бұрын
Has he seen PHP's variable variables?
@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 Жыл бұрын
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.
@mvargasmoran Жыл бұрын
Hell yeah! I'm not going back tho.
@32zim32 Жыл бұрын
In my test php swoole was faster then go in typical microservices scenario, surprise
@kevinyardie9135 Жыл бұрын
Jamaica 🇯🇲 in the building love your videos bro
@redpillsatori3020 Жыл бұрын
Ya mon. Welcome
@kevinyardie9135 Жыл бұрын
@@redpillsatori3020 huh! Like really bro you bugging 🤣🤣🤣🤣
@oldcastor- Жыл бұрын
not really most pushing forward release lol not a single example of performance, but in general php8+ going good
@Oprekode8 ай бұрын
am still use php 7.4
@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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
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.
@monstercameron Жыл бұрын
this looks messier than rust code
@JEsterCW Жыл бұрын
Fax
@CrichtonAda-j1p3 ай бұрын
Rogahn Cliff
@necastiv11 Жыл бұрын
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
@shugyosha79242 ай бұрын
I like PHP, especially now that Laravel makes it so easy to do stuff.
@joshuasy10 Жыл бұрын
Strike me down with all of your hatred, and your journey towards the dark side will be complete!
@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?" 😂
@MichaelAbramo Жыл бұрын
If you have to put a dollar sign before every variable name, you've already lost.
@deniskoronets4 ай бұрын
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
@luigibattaglioli6026 Жыл бұрын
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 Жыл бұрын
@ctxz9580you are but a novice - unable to understand beauty & grace
@ojsojs6004 Жыл бұрын
@ctxz9580 you don't understand what you are doing.
@StefanoV827 Жыл бұрын
...and still no Generics! 😢
@victoriabirch86603 ай бұрын
Ezekiel Pine
@peehi2 Жыл бұрын
WEN LARAGEN
@TheKomaras Жыл бұрын
Would be nice to see you go through Laravel :)
@Stoney_Eagle Жыл бұрын
You say you wouldn't hate Laravel, I say you'd like it.
@DorothyJackson-g7c4 ай бұрын
Janice Haven
@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
@jjones503 Жыл бұрын
PHP has always been the best language. Change my mind.
@LewisMosinski-l1o3 ай бұрын
Cummerata Mission
@soniablanche5672 Жыл бұрын
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.
@Im_Ninooo Жыл бұрын
nah, thanks I'll stick with Go.
@ever-modern Жыл бұрын
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.
@XDarkGreyX Жыл бұрын
You need some ice?
@Shogo_YK10 ай бұрын
phpagem
@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.
@fldgr Жыл бұрын
I thought it said 3 days ago - but it was 3 minutes ago. Anyways PHP is the one true superior language.
@martinhotmann7868 Жыл бұрын
Sorry just not superior in anything.. If you disagree, name in what it is superior to everything else.
@hitthemill8595 Жыл бұрын
@@martinhotmann7868being bad
@martinhotmann7868 Жыл бұрын
@@hitthemill8595 True that ^^
@javierflores09 Жыл бұрын
@@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
@roccociccone59710 ай бұрын
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.
@SurenEnfiajyan Жыл бұрын
Those features don't seem very popular. What I really want from a serious typed language, is support of generics.
@SXsoft99 Жыл бұрын
/** * @var Collection $list */
@CottidaeSEA Жыл бұрын
That can be achieved in PHP through a build step. Works quite well, but I wouldn't use it in production.