In (PHP 8.1) you have to use this --> function autoloader($class) { include_once "classes/$class.php"; } spl_autoload_register('autoloader'); $logger = new Logger(); $profile = new Userprofile($logger); $profile->createUser(); ?>
Sir OOP use kar k koi mini project toh bana k dikhaen jese codeigniter py kia tha aap ny.. It was very helpful agar using OOP bhi koi project banana sikha dengy toh hamary lia acha ho jaega.
Rahul, is example mein agar type hinting na use kiya jaye to kya hoga Jaise ki public function __construct(LoggerInterface $logger) ki jagah sirf public function __construct($logger) dala jaye to har wo class acceptable hogi jisme log() function hai.
Your Question is very good , i tested on this thing , and on basis of it i assume that typehinting is only for hinting purposes like enforcing the user to only use the variable of that particular class which class we are using as typehinting , even if u don't use typehinting than also your code will work similarly as it is working with typehinting , as in index.php file we are having this code:- $logger = new DBLogger; $profile = new UserProfile($logger); so when UserProfile Function we pass $logger variable with DBLogger Class in it , which connects the UserProfile Construct to DBLogger Class and show the message. But using type hinting has its own benefits.
it goes against the type hinting as we provide the object of classes like EmailLogger, DBLogger and FileLooger and where as we type hinting for LoggerInterface.
Hi Rahul Thanks for your wonderfull video. I just want to confirm that as you have used include_once("classes/$class.php") in __autoload function. Will that automatically include all the files which are placed in classes folder?
Hello Mr Rahul.. I'm enjoying your tutorial very much.. have you any tutorial on live project..? It would be useful for beginner like me after these series.. thanks..
I understood everything you meant. The only problem is I am not being able to run the program. Whenever I try to run the index.php , I get http error 500
hey.....rahul i get the error on same code that you write here i am mentioning about error Fatal error: Call to a member function log() on null in F:\XAMPP\htdocs\www\oops\polymorphism\classes\UserProfile.php on line 11
Awesome Video, Thanks for upload.
Great Series. Please add More & More
Videos are very useful and nice
add more & more
Thank you
Sound is very loww please increase it and can u share same topic tutorial with different functions...
In (PHP 8.1) you have to use this -->
function autoloader($class)
{
include_once "classes/$class.php";
}
spl_autoload_register('autoloader');
$logger = new Logger();
$profile = new Userprofile($logger);
$profile->createUser();
?>
Wooooooooooooooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwwwww so simply described.
I LOVE IT
thanks, sir this is nice and able to understand
amazing video thanks sir
kamaal kar dya
Very good.
sir ..
ap ny itni mushkil exampl le a.
logger ka kis ko pta o ga.
koi easy exampl ho jati to clear ho jna ta topic.
I really appreciate your effort that's very helpful thank you!!!
aj samjh i hai kay polymorphism kya hota hai , 4 saal saynhi pata chalta koi sahi example hi nhi daita, aap cha gay ho rahul
Nice video
Very Nice sir.
Superb tutorial....Please upload Lavarel tutorial
Great tutorial
Thanks for lovely Knowledge . Please do zend Frame work as well with certification .
Sir OOP use kar k koi mini project toh bana k dikhaen jese codeigniter py kia tha aap ny.. It was very helpful agar using OOP bhi koi project banana sikha dengy toh hamary lia acha ho jaega.
sir you did great efforts for us many thanks sir, please sir if possible advance sql bhi batao aap interview k prospective se
best
plz upload more video in this series.........
Rahul, is example mein agar type hinting na use kiya jaye to kya hoga
Jaise ki
public function __construct(LoggerInterface $logger) ki jagah sirf
public function __construct($logger) dala jaye to har wo class acceptable hogi jisme log() function hai.
Your Question is very good , i tested on this thing , and on basis of it i assume that typehinting is only for hinting purposes like enforcing the user to only use the variable of that particular class which class we are using as typehinting , even if u don't use typehinting than also your code will work similarly as it is working with typehinting , as in index.php file we are having this code:-
$logger = new DBLogger;
$profile = new UserProfile($logger);
so when UserProfile Function we pass $logger variable with DBLogger Class in it , which connects the UserProfile Construct to DBLogger Class and show the message.
But using type hinting has its own benefits.
great
nice video
Rahul Bhai ske sath main hi Design patterns bhi bta saktain hai.
Hi Rahul G
Best tutorials hai ...................
If any tutorials for zendframwork.....plz provied url
+Imran Hussain abhi tak to nai hai .. may be future mein karenge..
OK sir g
rahul ji plz function overloading or data abstraction par b tutorial banao...
Doing Great Job Sir :)
want to learn more on your #tutorialswebsite
it goes against the type hinting as we provide the object of classes like EmailLogger, DBLogger and FileLooger and where as we type hinting for LoggerInterface.
Hi Rahul
Thanks for your wonderfull video. I just want to confirm that as you have used include_once("classes/$class.php") in __autoload function. Will that automatically include all the files which are placed in classes folder?
Karan Raghav Yes, for detailed description watch this: ua-cam.com/video/-SKxAfdJi7M/v-deo.html
Hello Mr Rahul.. I'm enjoying your tutorial very much..
have you any tutorial on live project..? It would be useful for beginner like me after these series.. thanks..
I'll be making a project based on oops.. very soon.. stay tuned.. :)
sir kab start kren gay ??? i am waiting :)
what does __autoload function do? and how it works
I understood everything you meant. The only problem is I am not being able to run the program. Whenever I try to run the index.php , I get http error 500
please load every concept of oop .that should be simple
basic level and advance level.
Thanks
Class 'DBLogger' not found error come...pls tell me where i wrong?
i am new in codeigniter , plz help me , how to use css and jquey , and how to use images in html page it's not displaying
Sir polymorphism is only implemented by interface in php
Yes, In php polymorphism can be implemented by interface only.
will u pls provide another easy example for polymorphism pls?
Logger logger logger logger logger and here another logger... how many loggers are there??
sound is low and please share magic function series..
hey.....rahul
i get the error on same code that you write
here i am mentioning about error
Fatal error: Call to a member function log() on null in F:\XAMPP\htdocs\www\oops\polymorphism\classes\UserProfile.php on line 11
Please pass the parameter also in your log function.
nice video
oops video 1 to 9 ya aru bhi oop ka video upload kiya hai
i want to teach and understand complate laravel ??
then what can i do???
Dost theme white use kro visiblity achi rahegi viewers ko
hi rahul,
Do you have tutorials for objective-C and swift also?
+Ashish Pal No .. I do not have tutorials for those yet.
Thanks rahul to reply
Your php tutorials are very helpful.
why do you not like to work on windows?
this is last video of oops? (including magic function series video)
no there's more to come.. keep watching. :)
Please increase size of screen so I can view on my mobile
sir thoda zoom kr ke smjho. or isko zoom kr ke jarur bnana. part-9
AV Kashyap HD mein dekho saaf dihkega ..
ok thanks
in the polymorphism you did not provide exact example of polymorphism pls provide exact info and simple way
sir what is meaning $class.php in include_once("classes/$class.php");
+ankur mishra this is just a variable..
sorry to say but where's polymorphism in this video.? Whole video is full of dependency, type hinting, logger logger......
Mine is not happening giving different errors..
this video confusing me ...in helping this topic
sir can u explain wghat auto fnction load
Watch his magic function videos , there he has explained autoload function
end tutorials except from low sound in video
Sir, your voice is too low.
бюр мюр
bahut complicate kar rahe ho aap plz simple way mai samjhao
your videos were great till this example. this example has messed up everything in my head.
nice concepts , thanks