What's new in PHP 8.4?

  Рет қаралды 18,192

PHP Annotated

PHP Annotated

Күн бұрын

Пікірлер: 86
@imqqmi
@imqqmi Ай бұрын
PHP more and more looks like C#, I think it's a good thing.
28 күн бұрын
PHP#
@imqqmi
@imqqmi 28 күн бұрын
Very sharp!
@stjepanmajdak7396
@stjepanmajdak7396 28 күн бұрын
And C# is getting some unique PHP features with almost every new version
23 күн бұрын
@@stjepanmajdak7396 could you elaborate? That's interesting. I'm just curious, I've been using C# only little, two digits years ago.
@erickdeazevedolima1763
@erickdeazevedolima1763 Ай бұрын
I've been waiting for the asymetric visibility + property hooks combo for a decade (I used them in C# all the time before diving for real in PHP). I'm really excited for it.
@fabio.antunes
@fabio.antunes 29 күн бұрын
Hello. Just found your channel thanks to this video. Thanks for the summary and straight to the point examples. Awesome.
@nobodyspecial946
@nobodyspecial946 Ай бұрын
I rewinded more than 5 times to moment 3:36 :D They way you said it and you face expression make me laugh so much :D "It took them more than decade to add, but HEY! IT'S HERE"
@phpannotated
@phpannotated Ай бұрын
😂
@zonegamma8197
@zonegamma8197 29 күн бұрын
cool to see the language evolving a lot these last years
@qqleq
@qqleq Ай бұрын
Love it all! I used property get/set/let all the time when I was programming in VBA I think even thirty years ago! Finally I can do something similar, but better, in PHP. I think I will use almost all of the updates immediately, I have been needing them all for quite some time.
@pierrepracht
@pierrepracht Ай бұрын
30 years later... Only in PHP !
@GuzikPL4
@GuzikPL4 Ай бұрын
Some time a go Aaron Francis did a video about what changed in PHP since 2012 and i absolutely love these kind of videos. I would love to see more tricks and cool features i can use.
@phpannotated
@phpannotated Ай бұрын
Ah yes, I remember that video. Aaron's great! In my defence though, I was the first one to do such an evolution video (and Aaron made a better version inspired by mine :p ) kzbin.info/www/bejne/rmrFhIila7l6nbs
@taghwomillionaireo.5543
@taghwomillionaireo.5543 16 күн бұрын
Didn’t really understand the asymmetric visibility RFC, thanks for the explanation
@lostcarpark
@lostcarpark Ай бұрын
Very excited about property hooks, though asymmetric visibility means most of the time they won't even be needed.
@phpannotated
@phpannotated Ай бұрын
Absolutely true! Gonna be HUGE
@3fcf91cb4e
@3fcf91cb4e 7 күн бұрын
Would love to see your view on Magento's approach to backend, or maybe an interview with someone experienced with it - there's a lot of interesting stuff to talk about. I've been working with it for years and there's so many awful implementations of this platform that maybe a video on the standards and principles it uses could help some developers realize how much stuff they do wrong. And not going to lie - a video/podcast that would summarize some of the basic PHP principles and guidelines (not even diving into detail) would be a blessing for the juniors I work with, not sure if you have one already
@NeverCodeAlone
@NeverCodeAlone 22 күн бұрын
Very good video. Thanks a lot.
@xelframework
@xelframework Ай бұрын
properties hook are very interesting feature so far on php 8.4
@crossbow258
@crossbow258 28 күн бұрын
PHP is now similar to C#
@Pekz00r
@Pekz00r 29 күн бұрын
Asymetric visibility is a game changer! I tend to use public properties more often than I should because it is so annoying to create and call getters for every property. I'm really looking forward to never write a simple property getter without any logic again. For the times you need some basic logic property hooks are also great!
@coder236
@coder236 Ай бұрын
When they eventually bring out 9 I'd love them to add a decent concurrency model
@phpannotated
@phpannotated Ай бұрын
Oooh yeah that would be nice! I remember some people were looking at lib-uv compatibility around the 8.0 era for async/await support, but I don't think anything came from it
@coder236
@coder236 Ай бұрын
@@phpannotated if they could add it i think php would boom again. i love php but have been thinking of handing certain tasks over to a node or GoLang server for heavy lifting. anyway, keep up the awesome content ✌
@lostcarpark
@lostcarpark Ай бұрын
Fibres gets close, especially with revolt, and I think could be developed into full concurency. What I don't like about async/await in JS is the way it is used for many things that 99% of the time you want to use completely synchronously, but you have to include asynchronous boilerplate for the rare asynchronous use cases. I hope we can come up with a syntax that enables better concurency without imposing extra burden on simple use cases that just want to call an action and wait for it to finish.
@zebraforceone
@zebraforceone 29 күн бұрын
Check out fibres
@SXsoft99
@SXsoft99 29 күн бұрын
My DTO classes will become much cleaner :))
@llBestBoyll
@llBestBoyll Ай бұрын
That was vert informative thx ❤
@mr_raspberry_jam
@mr_raspberry_jam Ай бұрын
Where can I get one of them php elephants you have behind you?
@GopherOnline
@GopherOnline Ай бұрын
echo great video
@ramizazhar8891
@ramizazhar8891 Ай бұрын
forgot the ""
@GopherOnline
@GopherOnline 29 күн бұрын
@ramizazhar8891 😁
@abrahamolaobaju1781
@abrahamolaobaju1781 25 күн бұрын
looking good
@pranansubba9587
@pranansubba9587 20 күн бұрын
Idk why but getter and setter sounds quite logical if working in framework.
@Tigerman55
@Tigerman55 Ай бұрын
I think property hooks are more applicable to legacy projects (maybe), than it is to new code. You can use readonly classes and then you don't need any getters or setters anyways. Passing objects into a service with named constructors prevents the need for logic in either getters or setters. So it is moot point for most modern cases. Readonly with only private mutation is useful in some cases, I think.
@SXsoft99
@SXsoft99 29 күн бұрын
Not necessarily, you might want to set certain values in the constructor based on another value. Currently you either do it when you instantiate the class, or in the constructor but you move the property from being defined in your constructor method to being as a class property. The read only private thing is more than you can finally use the interfaces to define this functionality while currently you can only have props public.
@badasukerubin
@badasukerubin Ай бұрын
I can't wait for property hooks
@prometheus6001
@prometheus6001 29 күн бұрын
What IDE is that and if its IDEA, what template or how did you get to that look and feel?
@phpannotated
@phpannotated 29 күн бұрын
It's PhpStorm with the new layout (enabled by default in newest installs), and my custom color scheme: github.com/brendt/phpstorm-light-lite-theme
@31redorange08
@31redorange08 29 күн бұрын
Are there any use cases for PHP outside of extending CMS?
@SXsoft99
@SXsoft99 29 күн бұрын
- server-side CLI(Terminal) scripting, - automatic queue system in conjunction with linux supervisorCTL - desktop apps(be it a niche) - Web APIs, you can respond with Json, xml, file stream, etc. You are not limited to HTML
@31redorange08
@31redorange08 29 күн бұрын
@SXsoft99 I know that these things are possible, but why would you choose PHP over other languages (other than only knowing PHP)?
@merlin-1d
@merlin-1d 29 күн бұрын
Yes, if you're a developer and you're honest with yourself, you know exactly why😉
@LatenightDev
@LatenightDev 24 күн бұрын
@@31redorange08 Who says that ? What makes you think those who use PHP don't use other languages?
@31redorange08
@31redorange08 24 күн бұрын
@@LatenightDev That's not what I was saying.
@rustix3
@rustix3 Ай бұрын
I see a lot of things available in other languages are adopted in PHP, which is good. But when will set and map/dictionary data types be available outside of the box in PHP?
@zebraforceone
@zebraforceone 29 күн бұрын
Associative arrays are a map
@SXsoft99
@SXsoft99 29 күн бұрын
do you work only with auto indexed arrays? have you never done: $arr=[]; $arr['name']='test'; $arr['list']=['test_key' => 'text_val']; ?
@honk_tm
@honk_tm Ай бұрын
yes, I hate property hooks, other things are absolutely welcomed
@phpannotated
@phpannotated Ай бұрын
Fair enough!
@aurelian3401
@aurelian3401 Ай бұрын
print 'ok'; // amazing
@marius-v4s
@marius-v4s Ай бұрын
property hooks in interfaces is fucking huuuuge, they're cooking good
@CottonInDerTube
@CottonInDerTube Ай бұрын
3:00 That feels wrong. Doesnt this require a __construct to return $this (which actually returns void only)?
@krycekaiolfi
@krycekaiolfi Ай бұрын
The __construct is, returns void. But the 'new' keyword returns an object.
@farhanasultana9213
@farhanasultana9213 29 күн бұрын
PHP needs front end async features instead on relying on js, which will make it a full stack language.
@LatenightDev
@LatenightDev 24 күн бұрын
php doesn’t need to be asynchronous. as every request uses its own php thread. need to scale php? add more workers in your webserver. need to scale nodejs: run multiple instances behind a load balancer and carefully manage listening ports. php makes life easy, when low latency isn’t a strict requirement.
@asagiai4965
@asagiai4965 Ай бұрын
Hmm the ability to make setter private. Where have I seen that? Ah yes VB Maybe there's also in C# Anyway I think these are ok features.
@robwatson826
@robwatson826 Ай бұрын
All I want is a function autoloader then I'll be totally happy with PHP
@SXsoft99
@SXsoft99 29 күн бұрын
in your composer.json { ..., "autoload": { "files": [ "app/Helpers/helpers.php", ], }, ... }
@svobodnjk
@svobodnjk Ай бұрын
And still no generics... 😢
@SXsoft99
@SXsoft99 29 күн бұрын
you kinda have them as comments but not enforced :)) /** @var array $variable */ It helps with the IDE a lot you can also have complex ones /** @var array{name:string, tags:array{name:string}} */ works with @prop/@property-read/@method
@David-ng9qh
@David-ng9qh 29 күн бұрын
I really dislike the new deprecation of the implicitly marking a function parameter as nullable if it's default value is null. This was a great marker that a user should not pass in null, but that the implementation would resolve to a default (non-const) value at runtime if nothing was provided. I do not understand why this is deprecation worthy, I get that it is a weird thing, but it is also a great design pattern and is quite literally used everywhere. I use it everywhere, and laravel/framework does too. I understand just making the type nullable does not affect the way PHP handles this scenario at all, but it's about the semantics the consumer of a library will deal with, which will now be worse. Example ```php function a(int $b = null) { $b ??= get_default_value_for_b(); // ... } a(); // user knows not to pass in null a(1); // good
@phpannotated
@phpannotated 29 күн бұрын
Interesting! I personally never considered that use case 🤔
@SXsoft99
@SXsoft99 29 күн бұрын
they want to do it because a lot of devs abuse it and it leads to a lot of errors
@susanthawarnapura
@susanthawarnapura Ай бұрын
forget PHP 8.4 we need generic support and strict types
@holonaut
@holonaut 29 күн бұрын
Generics when?
@jsomhorst
@jsomhorst 29 күн бұрын
Never. Search and see it is really hard to implement in a language like this
@holonaut
@holonaut 29 күн бұрын
@jsomhorst actually generics already work with annotations and phpstan. PHP maintainers are just not adding it to the language out of spite at this point
@jsomhorst
@jsomhorst 29 күн бұрын
@holonaut yes I know. That is the IDE doing it's thing. PHP doesn't care.
@nikolayivanov321
@nikolayivanov321 Ай бұрын
Not sure how I feel about being able to use property hooks for promoted properties, I can see this getting ugly real fast. Other than that, it seems like a fantastic release.
@CottonInDerTube
@CottonInDerTube Ай бұрын
0:50 omg! Im not bi***ing, i just dont understand why this would make things better :D But hey - we can still use getters and setters =) _Which i will 100% do until i die._
@Someniatko
@Someniatko Ай бұрын
One use case is that you can add more logic to an already existing without having to convert all its users to use a getter/setter, keeping backwards compatibility
@turi.commodore
@turi.commodore Ай бұрын
i'm thinking of all the useless getters in my aggregates that will FINALLY be dropped thanks to private(set).... hell yeah
@a-yon_n
@a-yon_n 28 күн бұрын
Yet still doesn't have variable type notations and generics. It's frustrating to see a language evolve so much but actually change so little. I will never use PHP again until it has these two features.
@MLHAFAKOT
@MLHAFAKOT 29 күн бұрын
Stop using bright mode
@phpannotated
@phpannotated 29 күн бұрын
kzbin.info/www/bejne/o6aTeX1mlNCjqMU
@MelroyvandenBerg
@MelroyvandenBerg Ай бұрын
HTML5 support took only a decade to add hhaha. Classic
@Rhmtsky
@Rhmtsky 24 күн бұрын
Meh, i'll stick to 8.2 til php 9 released then.
@phpannotated
@phpannotated 24 күн бұрын
Ok 👌
@danser_theplayer01
@danser_theplayer01 Ай бұрын
The language name sounds like some old vacuum cleaner coughed up dust. pghhp💨
@Alex-pg1gt
@Alex-pg1gt 28 күн бұрын
Meh
@rickmyers7627
@rickmyers7627 Ай бұрын
Why not use magic methods for getting rid of getters and setters... seriously, this reason is why I left programming Java... PHP's magic methods, and autoloaders, are amazing and make coding "conventions over configuration" a breeze.
@krycekaiolfi
@krycekaiolfi Ай бұрын
Magic methods doesn't play nice with static analysis, intellisense, etc.
Inheritance in modern programming languages is different…
26:58
PHP Annotated
Рет қаралды 4,8 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 54 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 44 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 56 МЛН
PHP 8.4 Is Good
15:18
ThePrimeTime
Рет қаралды 130 М.
The Surprising Story of PHP
12:20
CodeSource
Рет қаралды 38 М.
Trying out the JIT in PHP 8.4
29:29
PHP Annotated
Рет қаралды 8 М.
Bun in 9 minutes
9:50
Simon Sorensen
Рет қаралды 641
I was too dumb for Laravel. Then they fixed it.
10:33
Theo - t3․gg
Рет қаралды 76 М.
Is PHP Dying in 2024?
18:30
Stefan Mischook
Рет қаралды 18 М.
Something is wrong with ISPs in India 🇮🇳
13:17
Mehul - Codedamn
Рет қаралды 46 М.
Advanced telescope.nvim Examples
14:12
TJ DeVries
Рет қаралды 18 М.
PHP 8.4: 3 New Features That I WON'T Use
6:25
Laravel Daily
Рет қаралды 6 М.