This is probably the best structured, explained and usable tutorial ever! And I went through many, many courses. This one is first to give me full explanation.
Interesting way of using an otherwise void returning methods as self returning ones to allow chaining. I'm learning a lot about PHP 8 as well as programming in general while using analogies with the languages I already know with your tutorials. Thanks for these series.
Bro, you really did a good job! Much better on those premium tutorials out there! Great work and keep it coming. Looking forward to Symfony after your Laravel course.
Thank YOUUU for your awesome tutorials man. The way you give example and explain why this wouldn't work or why it show this instead of that, is insane to me. You are simply the best out of all the tutorial i've been watching on youtube.
Very interesting video, first ever tutorial video that governs full utilisation of time. Very good, Please keep us providing such an awesome contents in future.
There was a lot of information to grasp, but course indeed is very good. Need to rewatch the video before going to next one. I have heard a lot of new people who start programming are struggling with OOP very much.
Done. Took me longer to go through this cause I was trying to grasp it all. I'm kinda struggling with the destruct method. I'll go over it. Again tomorrow. Well done Gio
Awesome work ! It's great to talk about Laragon because I see a lot of people using xamp or wamp but they lack some features that laragon provides. Docker is better but requires more technical knowledge and therefore is less for beginners.
Thank you. There are many solutions out there, I couldn't cover them all in this series, I chose the most popular one for the beginning (XAMPP) and then more advanced for the advanced section (Docker).
Wow, you have some amazing teaching skills with PHP. Thank you for teaching the "correct" and "best practice" way of doing things. I would only suggest that you slow down your talking. Hard to follow :).
Thank you. The speed gets better in 3rd section, I made editing mistakes cutting out empty spaces which is the main problem with the speed in these videos. You can also slow it down on UA-cam, sorry about that.
Fantastic series. I'm curious as to the extensions you have installed in VSCode. My IntelliSense doesn't complete the constructors and destructors the way your does.
Hi, Laracasts has some good episode on it that I could recommend. Aside from that I would look at Laravel's collection class and try to implement the interface that comes with it in your own custom way.
@@tedybg ua-cam.com/video/eibYr8928EY/v-deo.html If you go to Laracasts website you can search for collection and you'll get episodes specific to Laravel collection.
Thanks for you creating such an awesome PHP series. I love it. Inshallah, It would be very helpful for me if you answer my query. Which extension did you use for visual studio code for OOP syntax suggestions? Thanks!
Less prone to type related bugs. Easier to understand and maintain. Makes code a bit predictable while without typed you are forced to add some type check validations.
I only picked PHP because of this tutorial , YES i was thinking of going with python I am good with JS but there was not a single tutorial this massive on any language so i choose php only because of your tutorial my question here is , why return type is set to class , even if we dont specify a return type ( on addTax and addDiscount) we can return instance of object by simply returning $this or this is because of strict type that we do have to mention the return type
That's awesome, thank you & welcome. You don't have to specify return types, I just prefer to always have return types specified so that if wrong type is returned for whatever reason it errors out
@@ProgramWithGio this strict type is a life saver in JS you have a whole new kind of thing type script lol I'm pretty sure not a single tutorial will mention this like you did amazing
It is sometimes used as DTO (Data Transfer Object) and some API SDKs return objects of stdClass which you can easily convert to an array by casting. I don't think I ever had a good usecase specifically for stdClass.
Additional information for construct magic method; after the php 8.0 and later, you could use constructor promotion. Instead of; protected int $amount; public function __construct(int $amount) You could just use this short-hand public function __construct(protected int $amount)
@@ProgramWithGio yeah I've just seen it. I think i was hasty to comment it. It's my fault for thinking that in such a wonderful and detailed course you might have missed this detail. your videos are really good quality and you are a great teacher!
@@prabu2778 it's not missing, it's inside the playlist series. I just checked and it's all there. Thumbnails might look different for some videos because I'm updating thumbnails but the all videos are there
hii, i have a question, why accessing private properties of an object is not allowed, yet if i var_dump the object, i can see its private properties and their values?
Hi all, the vs code extension "phpfmt - PHP formatter v1.0.31" does not work when using type-hinting. We reported the bug and author does not seem to be bothered. His last update was in Jan 2022. Install PHP Tools.
In lesson 2.2 you said we have covered 'resource" data types but i am not sure in which lesson before this one did we cover resource type. Please help.
@@ProgramWithGio 1-30 does not cover the resource type fully. I that video you mentioned you will cover later. But in this video you say have already covered resources. Perhaps what you meant was it covered the type but not the functions related to resource types. Will i be correct in my understanding?
@@truthteachers not sure what you mean. In that video we covered what resource data type is, what functions are you referring to related to resources? I couldn't cover all resource related functions in that lesson because they are different topics if that's what you mean, we just covered the resource data type and file system related functions.
@@truthteachers yup, those functions are all related to their own topics, it's not like array functions, different resource functions work for different things.
I am battling with my brain to understand classes and objects, can we use facebook for exampley and can we say that a class is homepage , and it's object is a post?
Here is a simpler analogy. A Car is a class, a specific car (BMW) is an object of the Car class. A Person is a class, Kemal Gogic is an object of that class. Class is kind of like a blueprint where you create objects from
Sure you can, but this is Object Oriented PHP section, so if you prefer procedural and functional then this may not be the right course for you. Can build pretty good stuff with procedural PHP
hm, i've called new Transaction first and then var_dump($transaction->amount); but got error cannot access uninithialized property. i undestand, but in my class i have constructor function with arguments. and $this->amount = $amount; etc don't get it;
I can't understand the destruct method thing, about the three examples: In the first case 15:16 "...it will first call the destruct and then print the amount...", then you say that after "applyDiscount" there is no more reference, what do we mean exactly with reference? $amount->getAMount isn't still a reference to the object? The second case we still have a reference in the end so it first prints the amount and then it calls the destruct so it is consistent to me. Last case it seems the same of the first: 1) $amount = ( new Transaction(100, 'Transaction 1')) ->addTax(8) ->applyDiscount(10) ->getAmount(); // isn't like $amount->getAmount? var_dump($amount); // Destruct - amount 3) $transaction = ( new Transaction(100, 'Transaction 1')) ->addTax(8) ->applyDiscount(10); $amount = $transaction->getAmount(); var_dump($amount); // amount - Destruct
Destruct is called when nothing else is referencing the object. At 15:16 that object is only used in that spot so destruct is called before vardump. Try it out and play with it on your local and you'll get it
@@ProgramWithGio If I got it well in the first case the getAmount method is already called (with vardamp we only display the value returned) so we have no more reference while in the last case we still have to call the method so there is still a reference to the object.
@@ProgramWithGio I don't get the last case as --> $transaction = ( new Transaction(100, 'Transaction 1')) ->addTax(8) ->applyDiscount(10); $amount = $transaction->getAmount(); ----------------------------------------------------->refrence ends here var_dump($amount); // amount - Destruct as refrence ends befor var_dump why doesn't it execute destruct before var_dump like that of 1st case???
Probably misconfiguration, you can DM me on Twitter and I can assist troubleshoot it. You can also check the previous lesson again and make sure your config is correct.
I have heard that Canadian or American companies need a relevant university degree to hire a programmer. Especially for immigrants. Is this true? If we have a valid degree like Zend php certification is it still not acceptable?
Not sure about Canada but in the U.S. where they ask for PHP I have not seen a formal degree being required, either you have a degree or equivalent experience as far as I know, though I have not been on job market for awhile so things may have changed.
Hey Gio, I don't know why but I get this "Fatal error: Uncaught Error: Typed property Transaction::$description must not be accessed before initialization in /var/www/public/index.php:7 Stack trace: #0 {main} thrown in /var/www/public/index.php on line 7" error and my code looks 1:1 to yours. Timestamp is "Class constructor, $this & constructor arguments" section. If I just var_dump whole $transaction I get "object(Transaction)#1 (2) { ["amount"]=> uninitialized(float) ["description"]=> uninitialized(string) ["1.5"]=> float(1.5) ["test"]=> string(4) "test" }" So it looks like the app is still holding one uninitialized $amount and $description despite the fact I create an object and pass arguments. Do you have any idea why that could be?
Hey, that's because the properties are in un-initialized state until you set it to a value. It can be set in constructor or via default value or setter. You can make it nullable by adding ? to type hinting or simply set the default value to something
@@ProgramWithGio Thank you for a such prompt reply! I see, it indeed works now after either setting initial value or adding "?". Could you briefly explain why did it work in your code though (as in the video) without doing these things? btw this course is really golden, i'm impressed and really apprieciate you not only scratching the surface but diving deeply into php, I finally feel that I'll have some valuable skills and knowledge after completing it and not only being stuck at this "foundation" type of knowledge which is basically just like knowing some basics but not really enough to solve any real-scenario problems. Thank you!
@@pat1938 thank you. I briefly explained it from 4:51 to about 10:00 mark. You can see example of that error message there. It worked in my case because I initialized the value in constructor and before that I had it set to default value.
@@ProgramWithGio I had the contructor method and I just found out what the problem was.. basically I added $ sign before first amount and description and it caused the whole function not to work properly. So it looked like "$this->$amount = $amount;" instead of "$this->amount = $amount;" I'm not even sure why I did this. Maybe someone will run into the same mistake and find this comment. Thank you again Gio and have a good day:)
Thank you. You can slow it down on UA-cam by clicking on the cog icon & setting the playback speed to 0.75x or 0.5x. Hope that helps. I did improve on the speed a bit later on in the videos though.
I just checked and it's within the playlist, it's not missing. You don't see them in playlist? Thumbnails may be different for some because I'm updating them but all videos should be there.
Don't feel bad, I would suggest to watch the first section again and then come back to the second section. Second section is more advanced than first one. Though it's OOP and if you want to build web apps you will need OOP. If you have any specific questions you can ask me anytime
Using framework wont let you escape from OOP though, you still have to work with OOP even with framework, it just abstracts away a lot of the stuff and makes some things easier.
@@ProgramWithGio I think it's got to be that way though i.e. specialize in a framework to get a job. Web dev is just too much otherwise (the process of creating a site from scratch is so overengineered and excessively complex and in any case you might have to relearn everything if your next employer uses different frameworks)
@@illegalsmirf sure, but not knowing fundamentals & vanilla PHP will make building things with a framework harder. I use Laravel daily and it is very productive but I wouldn't be productive if I didn't know vanilla PHP and fundamentals
@@ProgramWithGio Just trying to do something simple like sort a table by ascending/descending values is super complex (requires a huge amount of JavaScript and there are dozens of ways of doing it), for me it is hopeless to make websites so complex that you need to master multiple programming languages (JavaScript plus something else for backend) plus any number of frameworks and on top of that design an OOP frameworks with data models. Trying to learn all this from scratch just causes me enormous frustration.
@@illegalsmirf I totally understand, for such websites you could use templates, or purchase a theme. I almost never build the whole UI from scratch, I just don't know JS that well & I suck at design so I focus on back-end and use any tools/frameworks/themes to build UIs or I hire someone who knows that part better than me.
my first impression with every tutorial, why not show just one way instead of showing 10 different ways of achieving the result, too much information overload and many of the other methods we will never use
He's not iterating over the same thing many times in different ways, he starts simple and is expanding the complexity of the subject to provide a comprehensive and deep understanding. These are not tutorials, these are lessons.
My goal was not to rush through the course and have a "Learn PHP in 2 hours crash course". My goal was to start simple and dig deeper & expand as @neozes explained. If your goal is to learn PHP quickly then this course may not be the right one for you. There are many other courses that skip over a lot of these details and are much shorter, so I would suggest you to give those a try
how to solve this error, when I add type hint to the variable, Parse error: syntax error, unexpected 'float' (T_STRING), expecting variable (T_VARIABLE) in /var/www/html/Transaction.php on line 7
The whole series is a goldmine! Thank you!
Thank you 🙌
I am in love with this series... This is a great intro to PHP.
Thank you
This is probably the best structured, explained and usable tutorial ever! And I went through many, many courses. This one is first to give me full explanation.
Glad to hear that, thank you 🙌
Been to OOP PHP for almost two years ago, but this journey seems interesting, Many Thanks!
Glad to hear that. You're welcome and thank you 🙌
it's unbelievable that I am getting this level of content for FREE I love it!
I want everyone to have access to learning PHP the "right way". The way I would want to learn myself if I was starting out. That's why it's free
By far this is the best php oop videos i've came across.
Thank you 💙
man this series is just amazingly, written, done, and so much informative, thank you sir
Glad you like it, thank you 💙
I AM definitely giving you tips after getting a job.. You taught me things i never imagine exits and your explanation are just the best..
Really glad to hear that, thank you. You getting a job will be the greatest tip for me
Interesting way of using an otherwise void returning methods as self returning ones to allow chaining. I'm learning a lot about PHP 8 as well as programming in general while using analogies with the languages I already know with your tutorials. Thanks for these series.
Great to hear! You're welcome
You are one of my best teacher in my PHP development You are doing great job, Thanks
Thank you 🙌
thanks this is the best php tutorial i am already working as php developer in every lesson i learned something new
Great to hear, thank you 💙
Clear code -laconic comments, excellent lessons.
Respect to Gio
Thank you 🙌
Bro, I never learned better than this course. You explained the best way
Glad to hear that. Thank you
Bro, you really did a good job! Much better on those premium tutorials out there!
Great work and keep it coming. Looking forward to Symfony after your Laravel course.
Thank you 💙💙
Thank YOUUU for your awesome tutorials man.
The way you give example and explain why this wouldn't work or why it show this instead of that, is insane to me.
You are simply the best out of all the tutorial i've been watching on youtube.
Glad to hear that, thank you so much 💙💙
Best video tutorial in UA-cam about Classes & Objects. Please start a Laravel Tutorial
Thank you. I'll be starting working on Laravel course soon
Very interesting video, first ever tutorial video that governs full utilisation of time. Very good, Please keep us providing such an awesome contents in future.
Thank you 🙌
There was a lot of information to grasp, but course indeed is very good. Need to rewatch the video before going to next one. I have heard a lot of new people who start programming are struggling with OOP very much.
Take your time
This is an amazing series!! Super helpful. Huge thanks!
Thank you 💙
best php course
Thank you 🙌
Done. Took me longer to go through this cause I was trying to grasp it all. I'm kinda struggling with the destruct method. I'll go over it. Again tomorrow. Well done Gio
That's ok, I sometimes need to watch videos multiple times as well to fully understand it. Thank you
You're awesome Gio. Thanks a lot. Appriciate your goodness! The course is so beneficial, loves from Baku!
Happy to hear that, thank you
Awesome work ! It's great to talk about Laragon because I see a lot of people using xamp or wamp but they lack some features that laragon provides.
Docker is better but requires more technical knowledge and therefore is less for beginners.
Thank you. There are many solutions out there, I couldn't cover them all in this series, I chose the most popular one for the beginning (XAMPP) and then more advanced for the advanced section (Docker).
Thanks! Thanks! Thanks!
You make me fall in love with PHP
Happy to hear that, thank you 💙
Thanks for you creating such an awesome PHP series.
Glad you like them!
the series is very awesome thank you so much
Glad you like them 🙌
This very helpful series to me, thanks dear.
Glad it was helpful 💙
you know so much.. thank you for sharing the knowledge! 💗
💙💙
thankyou so so so so much ....really appreciate your effort......these series are such a good help.......
Glad to hear that, thank you
Great lesson again!
Thank you
You are great instructor.
Thank you 🙌
Wow, you have some amazing teaching skills with PHP. Thank you for teaching the "correct" and "best practice" way of doing things. I would only suggest that you slow down your talking. Hard to follow :).
Thank you. The speed gets better in 3rd section, I made editing mistakes cutting out empty spaces which is the main problem with the speed in these videos. You can also slow it down on UA-cam, sorry about that.
EXCELLENT! Thank you Gio!
You're welcome, thank you 💙
Your tutorial is so awesome and I love it.
Thank you so much.
moving on.. thanks a lot.
You're welcome
Awesome tutorial
Thank you
This lesson is perfect!!!!!, Thank you
Thank you 🙌
Thank you so much for this amazing video
You're welcome
You're welcome
thank you for your tutorial! it is great!
You are welcome
Too much info thanku. New to me too
Take your time & watch it multiple times if needed, I know it can be overwhelming at times. Good luck & feel free to ask questions 👍
Fantastic series. I'm curious as to the extensions you have installed in VSCode. My IntelliSense doesn't complete the constructors and destructors the way your does.
I use PHPStorm
Thank you.
You're welcome
This is such a great course, thanks for sharing!
You're welcome and thank you 🙌
Thank you
You're welcome 💙
very very wonderful
Thank you 🙌
Hello Gio.
Thanks for these.
What PHP extension do you use with your VScode please?
Hello. I use phpstorm, not vscode
Alright.
Thanks Gio.
Thanks alot
you're welcome
bro thank you for lesson is amazing :)
You're welcome, thank you
superb
Thanks 💙
Thanks.
Hi Gio,
May I ask you to share knowledge about best practices for designing OOP collection classes?
Hi, Laracasts has some good episode on it that I could recommend. Aside from that I would look at Laravel's collection class and try to implement the interface that comes with it in your own custom way.
@@ProgramWithGio Can you please share Laracasts episodes that you mention? Thanks in advance!
@@tedybg ua-cam.com/video/eibYr8928EY/v-deo.html
If you go to Laracasts website you can search for collection and you'll get episodes specific to Laravel collection.
@@ProgramWithGio Thank you!
Awesome!!!!!!!!!!!!!!!!!!!!
💙💙
It was awsome, Thanks 😘
🙌🙌
Thanks for you creating such an awesome PHP series. I love it. Inshallah, It would be very helpful for me if you answer my query. Which extension did you use for visual studio code for OOP syntax suggestions? Thanks!
You're welcome, I dont use vscode so I'm not sure. I use phpstorm
@@ProgramWithGio Thank you so much for your reply. 💌
can i ask why type-hinting is recommended? is it for code readability or another reason?
Less prone to type related bugs. Easier to understand and maintain. Makes code a bit predictable while without typed you are forced to add some type check validations.
Can I follow your videos with Xammp instead of docker?
You should be able to. Will need to install few things along the way but they shouldn't be hard to install.
Very interesting...
👍
chaining methods = mind = blown
😎
Great
Thanks
I only picked PHP because of this tutorial , YES i was thinking of going with python I am good with JS but there was not a single tutorial this massive on any language so i choose php only because of your tutorial
my question here is , why return type is set to class , even if we dont specify a return type ( on addTax and addDiscount) we can return instance of object by simply returning $this or this is because of strict type that we do have to mention the return type
That's awesome, thank you & welcome. You don't have to specify return types, I just prefer to always have return types specified so that if wrong type is returned for whatever reason it errors out
@@ProgramWithGio this strict type is a life saver in JS you have a whole new kind of thing type script lol
I'm pretty sure not a single tutorial will mention this like you did amazing
@@evilservo yea, I prefer to use strict types when I can. Avoids silly bugs 🙂
6:50 Isn't "uninitialized" a separate data type then in PHP? Looks like it is for me.
Its more like a state
Is there any use for stdClass and object casting?
It is sometimes used as DTO (Data Transfer Object) and some API SDKs return objects of stdClass which you can easily convert to an array by casting. I don't think I ever had a good usecase specifically for stdClass.
Additional information for construct magic method; after the php 8.0 and later, you could use constructor promotion.
Instead of;
protected int $amount;
public function __construct(int $amount)
You could just use this short-hand
public function __construct(protected int $amount)
Yup, we cover that in the next video
@@ProgramWithGio yeah I've just seen it. I think i was hasty to comment it. It's my fault for thinking that in such a wonderful and detailed course you might have missed this detail. your videos are really good quality and you are a great teacher!
@@siyahkedilucifer heh, no worries & thank you 💙 🙌
Sir can you make separate playlist for oops
This is a full PHP series it includes OOP. Lessons are numbered this way 1.* Section 1 videos, 2.* Section 2, & 3.* Section 3.
@@ProgramWithGio some 2.3 , 2.4 ,2.5 videos are missing sir
My small request , make telegram group for PHP developers
@@prabu2778 it's not missing, it's inside the playlist series. I just checked and it's all there. Thumbnails might look different for some videos because I'm updating thumbnails but the all videos are there
hii, i have a question, why accessing private properties of an object is not allowed, yet if i var_dump the object, i can see its private properties and their values?
That's the point of private properties, it can't be accessed outside. Var dump is sort of internal function and used for debugging
bro my mind is melting
Why? 🙂
@@ProgramWithGio nevermind, i watched it a couple more times and started putting things together. Thx a lot for this series man, ur a beast.
@@dotsad that's great 🔥, glad to hear that. Thank you 🙌
Hi all, the vs code extension "phpfmt - PHP formatter v1.0.31" does not work when using type-hinting. We reported the bug and author does not seem to be bothered. His last update was in Jan 2022. Install PHP Tools.
In lesson 2.2 you said we have covered 'resource" data types but i am not sure in which lesson before this one did we cover resource type. Please help.
Within the lesson where we covered file system. 1.30 - ua-cam.com/video/p7F2GgVxHc0/v-deo.html
There is a timestamp for resource data type
@@ProgramWithGio 1-30 does not cover the resource type fully. I that video you mentioned you will cover later. But in this video you say have already covered resources. Perhaps what you meant was it covered the type but not the functions related to resource types. Will i be correct in my understanding?
@@truthteachers not sure what you mean. In that video we covered what resource data type is, what functions are you referring to related to resources? I couldn't cover all resource related functions in that lesson because they are different topics if that's what you mean, we just covered the resource data type and file system related functions.
@@ProgramWithGio Ah ok. I checked the php manual. The functions related resources are huge. Thank you for the feedback. Appreciated.
@@truthteachers yup, those functions are all related to their own topics, it's not like array functions, different resource functions work for different things.
👍🙏
💙
Ah there is alot of things.. i should watch 2-3 time to understand..
Please take your time and watch as many times as needed. I'm here to answer any related questions 👍
I am battling with my brain to understand classes and objects, can we use facebook for exampley and can we say that a class is homepage , and it's object is a post?
Here is a simpler analogy. A Car is a class, a specific car (BMW) is an object of the Car class. A Person is a class, Kemal Gogic is an object of that class. Class is kind of like a blueprint where you create objects from
@@ProgramWithGio thanks a lot!!!!
2Fast2Curious
:)
any why i have to use obj if i can simply use fun and pass params to ...
Sure you can, but this is Object Oriented PHP section, so if you prefer procedural and functional then this may not be the right course for you. Can build pretty good stuff with procedural PHP
hm, i've called new Transaction first and then var_dump($transaction->amount); but got error cannot access uninithialized property. i undestand, but in my class i have constructor function with arguments. and $this->amount = $amount; etc don't get it;
and arguments is present;
found. i misspleed __construct function name.
looks like java)
heh, good job on figuring it out
I can't understand the destruct method thing, about the three examples:
In the first case 15:16 "...it will first call the destruct and then print the amount...", then you say that after "applyDiscount" there is no more reference, what do we mean exactly with reference? $amount->getAMount isn't still a reference to the object?
The second case we still have a reference in the end so it first prints the amount and then it calls the destruct so it is consistent to me.
Last case it seems the same of the first:
1)
$amount = ( new Transaction(100, 'Transaction 1'))
->addTax(8)
->applyDiscount(10)
->getAmount(); // isn't like $amount->getAmount?
var_dump($amount);
// Destruct - amount
3)
$transaction = ( new Transaction(100, 'Transaction 1'))
->addTax(8)
->applyDiscount(10);
$amount = $transaction->getAmount();
var_dump($amount);
// amount - Destruct
Destruct is called when nothing else is referencing the object. At 15:16 that object is only used in that spot so destruct is called before vardump. Try it out and play with it on your local and you'll get it
@@ProgramWithGio If I got it well in the first case the getAmount method is already called (with vardamp we only display the value returned) so we have no more reference while in the last case we still have to call the method so there is still a reference to the object.
@@rosarioveneruso9928 Yup exactly
@@ProgramWithGio I don't get the last case as -->
$transaction = ( new Transaction(100, 'Transaction 1'))
->addTax(8)
->applyDiscount(10);
$amount = $transaction->getAmount(); ----------------------------------------------------->refrence ends here
var_dump($amount);
// amount - Destruct
as refrence ends befor var_dump why doesn't it execute destruct before var_dump like that of 1st case???
@@rudrakshigupta2965 I explain that part at 15:46. Reference doesn't end there, object still exists until end of script execution
I have a problem with the index page. Instead of showing the phpinfo, it's showing the welcome page of Nginx. How can I fix it?
Probably misconfiguration, you can DM me on Twitter and I can assist troubleshoot it. You can also check the previous lesson again and make sure your config is correct.
What is it called when you create a function with a parameteer and a custom type ?
function(Product $item){
CONTENT;
}
Still a function unless it's part of a class which is then called a method
I have heard that Canadian or American companies need a relevant university degree to hire a programmer. Especially for immigrants.
Is this true? If we have a valid degree like Zend php certification is it still not acceptable?
Not sure about Canada but in the U.S. where they ask for PHP I have not seen a formal degree being required, either you have a degree or equivalent experience as far as I know, though I have not been on job market for awhile so things may have changed.
Hey Gio, I don't know why but I get this
"Fatal error: Uncaught Error: Typed property Transaction::$description must not be accessed before initialization in /var/www/public/index.php:7 Stack trace: #0 {main} thrown in /var/www/public/index.php on line 7"
error and my code looks 1:1 to yours.
Timestamp is "Class constructor, $this & constructor arguments" section.
If I just var_dump whole $transaction I get "object(Transaction)#1 (2) { ["amount"]=> uninitialized(float) ["description"]=> uninitialized(string) ["1.5"]=> float(1.5) ["test"]=> string(4) "test" }"
So it looks like the app is still holding one uninitialized $amount and $description despite the fact I create an object and pass arguments.
Do you have any idea why that could be?
Hey, that's because the properties are in un-initialized state until you set it to a value. It can be set in constructor or via default value or setter. You can make it nullable by adding ? to type hinting or simply set the default value to something
@@ProgramWithGio Thank you for a such prompt reply! I see, it indeed works now after either setting initial value or adding "?".
Could you briefly explain why did it work in your code though (as in the video) without doing these things?
btw this course is really golden, i'm impressed and really apprieciate you not only scratching the surface but diving deeply into php, I finally feel that I'll have some valuable skills and knowledge after completing it and not only being stuck at this "foundation" type of knowledge which is basically just like knowing some basics but not really enough to solve any real-scenario problems. Thank you!
@@pat1938 thank you. I briefly explained it from 4:51 to about 10:00 mark. You can see example of that error message there. It worked in my case because I initialized the value in constructor and before that I had it set to default value.
@@ProgramWithGio I had the contructor method and I just found out what the problem was.. basically I added $ sign before first amount and description and it caused the whole function not to work properly.
So it looked like "$this->$amount = $amount;"
instead of "$this->amount = $amount;"
I'm not even sure why I did this. Maybe someone will run into the same mistake and find this comment. Thank you again Gio and have a good day:)
@@pat1938 glad you figured it out 👍
great play list , but it will be super great if you did not make the videos fast like this.
Thank you. You can slow it down on UA-cam by clicking on the cog icon & setting the playback speed to 0.75x or 0.5x. Hope that helps. I did improve on the speed a bit later on in the videos though.
Sir ,
2.3
2.4
2.5
Gold mines Missing sir
I just checked and it's within the playlist, it's not missing. You don't see them in playlist? Thumbnails may be different for some because I'm updating them but all videos should be there.
Here is link to the playlist: ua-cam.com/play/PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-.html
This is little advanced and tough for me :(
Don't feel bad, I would suggest to watch the first section again and then come back to the second section. Second section is more advanced than first one. Though it's OOP and if you want to build web apps you will need OOP. If you have any specific questions you can ask me anytime
that's a lot. haha. I need to break after this video.
Taking breaks is important
why do we need stdClasses ?? 🤔🤔
in a lot of cases we don't. Here its just an example
OOP is so painful to learn that I kind of want to just a framework just to abstract/automate it all away for me lol.
Using framework wont let you escape from OOP though, you still have to work with OOP even with framework, it just abstracts away a lot of the stuff and makes some things easier.
@@ProgramWithGio I think it's got to be that way though i.e. specialize in a framework to get a job. Web dev is just too much otherwise (the process of creating a site from scratch is so overengineered and excessively complex and in any case you might have to relearn everything if your next employer uses different frameworks)
@@illegalsmirf sure, but not knowing fundamentals & vanilla PHP will make building things with a framework harder. I use Laravel daily and it is very productive but I wouldn't be productive if I didn't know vanilla PHP and fundamentals
@@ProgramWithGio Just trying to do something simple like sort a table by ascending/descending values is super complex (requires a huge amount of JavaScript and there are dozens of ways of doing it), for me it is hopeless to make websites so complex that you need to master multiple programming languages (JavaScript plus something else for backend) plus any number of frameworks and on top of that design an OOP frameworks with data models. Trying to learn all this from scratch just causes me enormous frustration.
@@illegalsmirf I totally understand, for such websites you could use templates, or purchase a theme. I almost never build the whole UI from scratch, I just don't know JS that well & I suck at design so I focus on back-end and use any tools/frameworks/themes to build UIs or I hire someone who knows that part better than me.
Thank you for not using VScode
I don't have anything against VScode but I do prefer phpstorm :)
i loved the videos but the more i get into the lesson the faster you work. i cant barely see what your typing even though i try to paus
You can slow it down on UA-cam, press the gear icon & set playback speed to 0.75x or 0.5 whatever works for you.
Okay, I will stay away from Destructors
You don't really need to worry about them or use them until you have a specific use case
my first impression with every tutorial, why not show just one way instead of showing 10 different ways of achieving the result, too much information overload and many of the other methods we will never use
He's not iterating over the same thing many times in different ways, he starts simple and is expanding the complexity of the subject to provide a comprehensive and deep understanding. These are not tutorials, these are lessons.
My goal was not to rush through the course and have a "Learn PHP in 2 hours crash course". My goal was to start simple and dig deeper & expand as @neozes explained. If your goal is to learn PHP quickly then this course may not be the right one for you. There are many other courses that skip over a lot of these details and are much shorter, so I would suggest you to give those a try
how to solve this error, when I add type hint to the variable, Parse error: syntax error, unexpected 'float' (T_STRING), expecting variable (T_VARIABLE) in /var/www/html/Transaction.php on line 7
Looks like a syntax error. Show me your code at line 7 and I'll help you.
it was because php version less than PHP7.4, already fixed it, thanks
@@emansayma3361 awesome 👍
Thank you so mutch. bro❤🧡💛💚💙💜🤎🖤🤍
Always welcome
This series about PHP is the best! Thanks a lot!
Thank you 💙
thank you sir
You're welcome 💙