i have been using youtube for 15 years to study , hands down your the best teacher , tha a man can hope for
@ProgramWithGio10 ай бұрын
Thank you 💙
@only_visiting5 ай бұрын
Agreed 100%!
@lynic-0091 Жыл бұрын
Jaw drop, I had no friggin clue something like this was possible. This is the best PHP course I've ever seen.
@ProgramWithGio Жыл бұрын
Thank you 🙏
@Vitalii-m6r Жыл бұрын
Hands down, this is the best explanation of Iterators I've even seen. Thanks!
@ProgramWithGio Жыл бұрын
Happy to hear, thank you 💙
@karam01012 жыл бұрын
Every time I see the number of subscribers increased I feel really happy, cause I hope every body watches this series in which you're making programming more exciting and more fun! thank you
@ProgramWithGio2 жыл бұрын
Thank you 💙💙
@muhammadaafaq4822 жыл бұрын
I'm really enjoying this series and learning more Respect from Pakistan.
@ProgramWithGio2 жыл бұрын
Glad to hear that, thank you 💙💙
@federicobau86512 жыл бұрын
Extremely simple explanation
@KochADV9 сағат бұрын
great lesson. thanks
@khusamalfas21213 жыл бұрын
This the best class about iterators with examples. Keep it up will done.
@ProgramWithGio3 жыл бұрын
Thank you
@FranciscoJunior292 жыл бұрын
Thank you so much for sharing this content of excellent quality.
@ProgramWithGio2 жыл бұрын
You're welcome 🙌
@ilya_123__11 ай бұрын
Thank you for this lesson!
@ProgramWithGio11 ай бұрын
You're welcome
@emekatimothyiloba699 Жыл бұрын
Thank you Gio
@ProgramWithGio Жыл бұрын
You're welcome
@Haamome2 жыл бұрын
i love you bro thank you so much for all those videos clear and simple example that make it easy.
@ProgramWithGio2 жыл бұрын
Glad you like them, thank you 💙💙
@Armando-px8hi Жыл бұрын
Thank you GIO:)
@ProgramWithGio Жыл бұрын
You're welcome
@Zubbee2 жыл бұрын
Great lesson, I've bagged another one (need to practice though). Thanks alot Gio.
@ProgramWithGio2 жыл бұрын
Awesome, thank you 💙 keep going
@aleksandrkanygin26722 жыл бұрын
Great lesson, thank you!
@neriusshaqiri15142 жыл бұрын
Thank you for tor sharing this, great video!
@ProgramWithGio2 жыл бұрын
Glad you enjoyed it, thank you 💙
@omaryahia Жыл бұрын
amazing 🌟
@ProgramWithGio Жыл бұрын
Thank you! 😊
@derzskyi12 жыл бұрын
Thank you! "Invoice" inside "InvoiceList" iterable must have public properties, but what if I don't want to expose the internal state of that object. What are the options for this?
@ProgramWithGio2 жыл бұрын
In PHP 8.1 you can make properties read-only, that way you can have public property accessible but can't be changed. You can also just make them private/protected and create appropriate getter/setters.
@benderbg3 ай бұрын
Thanks!
@ProgramWithGio3 ай бұрын
No problem!
@ינוןאלבז-כ1ז Жыл бұрын
I dont know any of that topic. Thanks!!!!!!
@ProgramWithGio Жыл бұрын
🙌🙌
@abdallahdamra5602 Жыл бұрын
instead of implementing iterator, why not just use nested foreach loop? or you just did it to show the implementation of iterator?
@ProgramWithGio Жыл бұрын
It depends on the data structure of what you are iterating over. If its just simple arrays then yea sure you should just use foreach loop on the array, if its a complex data structure or you need more control over how its iterated over then you implement iterator.
@memack1012 жыл бұрын
Thank you.
@ProgramWithGio2 жыл бұрын
You're welcome 👍
@diarqoroviqi48692 жыл бұрын
Great lesson, it would be greater if you add an iterator example of linked list? Thank you :)
@ProgramWithGio2 жыл бұрын
Thank you & thanks for the suggestion 💙
@dameeldiop341 Жыл бұрын
I've been watching this video as guide to iterate over an object (deep nested, tree data) using RecursiveIteratorIterator & RecursiveArrayIterator but couldn't make it work. Any enlightenment on those recursive classes?
@ProgramWithGio Жыл бұрын
What is the issue that you are having, can you share more details?
@engenglish610 Жыл бұрын
In which video did you introduce Route code ?
@ProgramWithGio Жыл бұрын
Search the playlist & you will find it. I think its 2.23, link to the outline repo is in the description
@houbaben16112 жыл бұрын
Hello Sir, I am having a problem when I use the iterator interface, I am getting the result but before it there is a message telling me that: Deprecated: Return type of app\InvoiceCollection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
@ProgramWithGio2 жыл бұрын
Hello, add mixed as return type to your key method.
@houbaben16112 жыл бұрын
@@ProgramWithGio thank you very much it works
@b4rt1j12 жыл бұрын
Hi, may i ask that next method 4:35 must return void, why are you returning next($this->invoices) ? Its throwing errror in my IDE
@ProgramWithGio2 жыл бұрын
Hey, what error are you getting? The next method does not need to return anything, it can be void, though in some cases it might be useful to return something which is what I'm showing. You can have it as void & just remove the return part, make sure to still have the next($this->invoice)
@b4rt1j12 жыл бұрын
@@ProgramWithGio Error was incompatible interface, so i got rid of return stmt and it worked.
@thrldr31062 жыл бұрын
I didn't quite get why variable $key in the InvoiceCollection class got initialized with 0 whereas you haven't explicitly set it to be. Is this some feature of php8 or am I missing something? Because my interpreter doesn't allow for it.
@ProgramWithGio2 жыл бұрын
It is set to 0 in rewind method explicitly 7:40
@davidmutua6971 Жыл бұрын
Yes because rewind gets called at the very beginning
@giotapetrou2801 Жыл бұрын
I tried the code and I still get the error "Fatal error: Uncaught Error: Cannot access protected property App\Lesson222\Invoice::$id". I'm I missing something?
@ProgramWithGio Жыл бұрын
You may have copied code wrongly. Error says you are trying to access protected property. Share the full code if you can
@giotapetrou2801 Жыл бұрын
class Invoice { protected string $id; public function __construct(private float $amount) { $this->id = random_int(10000, 99999); } } class InvoiceCollection implements \IteratorAggregate { /** * @param Invoice[] $invoices */ public function __construct(public array $invoices) { } public function getIterator(): Traversable { return new \ArrayIterator($this->invoices); } } //index.php $invoiceCollection = new InvoiceCollection([new Invoice(15), new Invoice(25), new Invoice(30)]); echo ''; foreach ($invoiceCollection as $invoice) { echo $invoice->id.' - '. $invoice->amount. ''; } echo '';@@ProgramWithGio
@giotapetrou2801 Жыл бұрын
thank you in advance!
@abdussukkur90803 жыл бұрын
why 56 no video is private?
@ProgramWithGio3 жыл бұрын
It was deleted before it was published & new one was uploaded in its place. Forgot to remove it from playlist. Shouldnt be there anymore. Thanks for letting me know
@HasinthaWeragala Жыл бұрын
Fast and Furious PHP edition
@ProgramWithGio Жыл бұрын
You can slow it down on KZbin buddy 👍
@sujithm.p97762 жыл бұрын
I didn't get when we use iterator. What is the use case.
@ProgramWithGio2 жыл бұрын
When you want to make some class iterable, like a custom collection class as an example.
@sujithm.p97762 жыл бұрын
@@ProgramWithGio okay. I understood there will be a collection of objects and we need to iterate over these objects in foreach this is useful. Apart from that what is the advantage? Is there any advantage while reading data from database? Performance wise?
@ProgramWithGio2 жыл бұрын
@@sujithm.p9776 yes if you are working on a large data set you can use iterators/generator to reduce memory consumption and not load everything in memory at once. We cover generators as well in this series.
@sujithm.p97762 жыл бұрын
@@ProgramWithGio well I understood the scenario. But little curious to know whether laravel uses this concept?
@ProgramWithGio2 жыл бұрын
Yes, lazy collections use generators
@dhirendrasinghnegi7948 Жыл бұрын
how the invoice collection class is calling these methods in this class nowhere in code you are calling them
@b.c.2177 Жыл бұрын
This course is rather demonstration of your skeels than a course for learning PHP. You are talking non stop, like a machine, trying to impress the watchers, but people are not machines. So, it is vey hard to learn PHP watching such a course, even it looks nice and reach.
@ProgramWithGio Жыл бұрын
I'm not trying to demonstrate anything or impress anyone. I've made editing mistakes in the beginning where I cut out empty spaces making it seem like I don't stop. You can easily slow it down on KZbin by clicking the ⚙️ icon. As you can see from the comments, others find it helpful, so if it doesn't work for you feel free to watch something else. Cheers