PHP 8 3 Released

PHP 8 3 Released

ThePrimeTime

5 месяцев назад

95,956 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Enkii Muto
Enkii Muto - 28.11.2023 10:31

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.

Ответить
Rashid Iqbal
Rashid Iqbal - 28.11.2023 10:11

I hate php because it cant be compiled to vanilla js

Ответить
Sevil Natas
Sevil Natas - 28.11.2023 07:29

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?

Ответить
Yaroslav (JLarky) Lapin
Yaroslav (JLarky) Lapin - 28.11.2023 07:12

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

Ответить
monstercameron
monstercameron - 28.11.2023 06:55

this looks messier than rust code

Ответить
Luigi Battaglioli
Luigi Battaglioli - 28.11.2023 06:34

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.

Ответить
Sonia Blanche
Sonia Blanche - 28.11.2023 06:25

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.

Ответить
Donald Winston
Donald Winston - 28.11.2023 05:51

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

Ответить
limpqizbuit
limpqizbuit - 28.11.2023 05:25

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

Ответить
Heitor Rodrigues
Heitor Rodrigues - 28.11.2023 01:47

Laravel is GOOD.

Ответить
Dante
Dante - 28.11.2023 01:34

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?

Ответить
Dalton Yo
Dalton Yo - 28.11.2023 01:15

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

Ответить
Stoney_Eagle
Stoney_Eagle - 28.11.2023 01:13

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

Ответить
Apollolux
Apollolux - 28.11.2023 01:11

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.

Ответить
Kris Tan
Kris Tan - 28.11.2023 00:38

Deep cloning works great for date classes

Ответить
ALIendroid
ALIendroid - 27.11.2023 23:57

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

Ответить
Justin Wenning
Justin Wenning - 27.11.2023 23:18

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.

Ответить
Connor Skudlarek
Connor Skudlarek - 27.11.2023 22:29

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.

Ответить
Barney Laurance
Barney Laurance - 27.11.2023 22:11

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.

Ответить
Steve Kirsch
Steve Kirsch - 27.11.2023 22:10

finally one video about not hating php

Ответить
Cottidae
Cottidae - 27.11.2023 21:44

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.

Ответить
Em Te
Em Te - 27.11.2023 21:36

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.

Ответить
Occupy Mars
Occupy Mars - 27.11.2023 21:35

I haven’t touched PHP in about 10 years, how do you guys handle JS nowadays?

Ответить
ZeoCamo
ZeoCamo - 27.11.2023 21:25

the \ is for namespaces

Ответить
arber.studio
arber.studio - 27.11.2023 21:24

stream an episode on why you hate Javascript lol

Ответить
TheJezzi
TheJezzi - 27.11.2023 21:19

Still waiting for that big major update that reduces the set of features

Ответить
Matteo Bortolazzo
Matteo Bortolazzo - 27.11.2023 21:15

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

Ответить
Clickbait
Clickbait - 27.11.2023 21:10

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

Ответить
Just Jess
Just Jess - 27.11.2023 21:02

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

Ответить
Kiba
Kiba - 27.11.2023 20:45

php is a must for web

Ответить
Taylor Koepp
Taylor Koepp - 27.11.2023 20:43

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

Ответить
Matthew
Matthew - 27.11.2023 20:41

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

Ответить
peehi2
peehi2 - 27.11.2023 20:16

WEN LARAGEN

Ответить
tariq
tariq - 27.11.2023 20:05

why your videos are not 4k ?

Ответить
Roel Hemerik
Roel Hemerik - 27.11.2023 19:55

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.

Ответить
Pyakz
Pyakz - 27.11.2023 19:42

PHP is great, old projects that you get assignrd to, is not 🥴

Ответить
Still Dreamy
Still Dreamy - 27.11.2023 19:37

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.

Ответить
Bingle, bangle, bungle I'm so happy in the Jungle
Bingle, bangle, bungle I'm so happy in the Jungle - 27.11.2023 19:36

Backslashes for namespace separators 🤮

Ответить
Charlie A
Charlie A - 27.11.2023 19:13

PHP looks like java now

Ответить
loek
loek - 27.11.2023 19:10

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

Ответить
Yurij Uvarov
Yurij Uvarov - 27.11.2023 19:02

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

Ответить
Svet
Svet - 27.11.2023 18:57

Would be nice to see you go through Laravel :)

Ответить
Still Dreamy
Still Dreamy - 27.11.2023 18:57

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.

Ответить
Nino
Nino - 27.11.2023 18:53

nah, thanks I'll stick with Go.

Ответить