NOTE: In this video I say that "_autoload" would get "depreciated", when I meant to say "discouraged". depreciated = will get discontinued discouraged = is not recommended I know there are viewers out there that care a lot about proper phrasing and such, so I thought I'd clarify here :)
@wren71825 жыл бұрын
Somewhere in Germany you are helping a whole bunch of bachelor students... :)
@zaidh415 жыл бұрын
upload full login system with pdo please...........
@pxjesse81285 жыл бұрын
Hey, I'm having an error where the autoloader can't find the file because it's looking for the capitalized "Person.class.php", while mine is called "person.class.php". Any idea why this is happening for me and not for you in the video? Thanks in advance ;)
@davidspooner50215 жыл бұрын
www.php.net/manual/en/function.autoload.php says that __autoload() "has been DEPRECATED as of PHP 7.2.0. "
@mrpddnos5 жыл бұрын
PXJesse the paths are case sensitive. You either need to make spelling of your file names the same as the spelling of your class names or use strtolower() around $className in the myAutoloader() function
@bigdoggetom65494 жыл бұрын
One thing worth mentioning, if your server is running on Linux, you need to make two adjustments to what Dan has done in the video. Firstly, as Linux (unlike WIndows) is case sensitive, if you are calling your classes with a capital letter (eg. Person, rather than person, like in the video), you need to also make sure your class file is capitalised, eg. Person.class.php. Secondly, if using namespaces, you need to make a change to the autoloader function. As Linux uses forward slashes for file directories, you should add: $fullpath = str_replace('\\', '/', $fullpath); to replace the backslashes picked up with forward slashes. I believe even if you add this line, it will also still work on Windows anyway
@ThePancakeJedi4 жыл бұрын
THANK YOU! I've been looking all over as to what the problem might be. Should've looked in the comment section sooner.
@liamkao16534 жыл бұрын
thank you! you save me.
@hectorluis92943 жыл бұрын
You save my day dude.
@karanraiyani35793 жыл бұрын
Thank you for saving my time
@ChadAmI803 жыл бұрын
Thank you! For the life of me I couldn't figure out why when I set the namespace to Person\Person that this was not running when I had my class named Person.class.php I'm running windows using Local from FlyWheel as my "server". This fixed it.
@Mesrour10 ай бұрын
I can't imagine someone who can teach coding with simple and clear explanations like you. When someone understands the 'WHY', he can explain anything. If not, he will resort to repeating incomprehensible puzzles.
@francoisbourvil87335 жыл бұрын
I really hope you'll get many more subscribers, because even for someone who already "knows" OOP in PHP, your explanations are very clear and easy to follow. You really ease the understanding of that core concept ! Thanks for these great courses !
@powpowalemany39904 жыл бұрын
I am a new to PHP programming and have done too many procedural programming, actually I use procedural programming in our capstone project. I've heard a lot in OOP and done some research about OOP and I had a hard time studying OOP until I saw your tutorials about OOP(PHP) it is easier to understand the way you explain things. Thank you so much.
@kelvezu15855 жыл бұрын
You're the best PHP teacher. Thanks Dan
@mh_reja4 жыл бұрын
I was scaring to get into OOP php, when I was trying to understand it, my brain stopped working. But, you have eased all this, you teach in a very supercallifragilistic way. As of now my brain has started working 😆😊 to understand php OOP. Thank you very much.
@brunosastre13173 жыл бұрын
I love how enthusiastically you teach!
@tictac10204 жыл бұрын
I've been coding for something like 6 years now (front end) and there's a handful of areas where my brain never quite clicked. MVC in PHP is one of those areas. I have realized over time that my brain needs the conceptual explanation, the abstract high level overview of things instead of just the explicit instructions on implementation. If I understand the idea of how it's supposed to work, I can figure out the implementation. All this is to say I really love your style of teaching and that you focus on the concept and not just the implementation. Cheers!
@marlub24 күн бұрын
I've just gone through your episode with morning coffee :) A pill of very usefull information for me while learning php. Great tut!
@richardwilkins52412 жыл бұрын
This was a great PHP OOP 'good-housekeeping' lesson. Really helpful. Thank you.
@mhassan20185 жыл бұрын
keep going man i really enjoy each and every single episode you make
@robertbajo94745 жыл бұрын
Great! Man your tutorials about coding in PHP are one of the best on youtube!
@robustreviews3 жыл бұрын
Perfect as ever! For a little bit of finesse in production (and to hide anything useful to a hacker) you can change _return false;_ to an error handler: die("Error - Please try again later"); or an error code, or whatever works best for your project.
@juliusmboto72892 жыл бұрын
I learned a lot from you sir!, but one thing, i follow everything on this video about Load classes Automatically. But for me doesnt work but i tried to find a solution then i came up with and it works for me!, so in case anyone facing this issue, please try the suggestion i just provided! Anyway big thanks for sharing free resource to the world.
@hayatzee88302 жыл бұрын
Same here, Thank you for the alternative solution.
@ngabers33133 ай бұрын
your code is more simplier
@potatochipappiАй бұрын
You are good thanks, I can’t believe this approach is simpler I even understand this by reading.
@vladiklass18904 жыл бұрын
Thank you so much for explaining it in such an interesting way that I'm watching it instead of Netflix on Sunday afternoon! :D
@guscostarock2 жыл бұрын
Wow man, you really have the talent to make a hard concept become easy, I appreciate your work and it is helping me a lot.Thanks for that!
@kristapsvecvagars50495 жыл бұрын
Love your videos! You just have a way of explaining things so clearly, something that most of my teachers struggled to do, especially with OOP concepts. Thank you for your work and dedication!
@trishapellis10 ай бұрын
I have seen someone else comment this on another video of yours, but here nobody seems to be doing it, so I'll put it here for anyone who gets confused about this in the future (because I did). I think it's a consequence of using Linux/Ubuntu or something like that, but the autoloader may fail for no apparent reason. For people who have this problem, try turning the line "$fullPath = $path . $className . $extension;" into "$fullPath = $path . strtolower($className) . $extension;". The problem in this case is that the program differentiates between uppercase and lowercase. Since we're obligated to write class filenames in all lowercase, but the class name itself has to be capitalized, the autoloader can't find the file, because it's looking for a capitalized file name. Strtolower makes the $className variable lowercase.
@mhc41244 жыл бұрын
Man, thank you. Best instructing style that I've found out there.
@syrymzhakypbekov19495 жыл бұрын
Great content, and speech delivery is in a very high level, thank you man
@FaizulHassan-ek2mw3 жыл бұрын
Beautifully described by a graceful young man. Great!
@_timestamp5 жыл бұрын
Best php channel. Good job Daniel, good job
@johwel3405 жыл бұрын
Elon Musk looks like you or you look like Elon Musk :-D
@dfordemo9814 жыл бұрын
hehe same comment as i did in first video,
@virusbastion75265 жыл бұрын
You the best out there man... Thank you very much... My college teacher sucks
@markgilsongregorio5364 жыл бұрын
I learned a lot from you Sir. Dan, 9 more episodes to go! Thank you so much for the lectures
@GerritforBazeja Жыл бұрын
Thank you for again a nice video in order to learn me OOP!! Never te late to learn or dive into it later on.
@wing-views3 жыл бұрын
15:06 That was me. Jumped to 17th chapter. Got an error and watching this video. ;)
@MuhammadAli-sl9qd4 жыл бұрын
spl_autoload_register('classLoader'); function classLoader($class){ $path = "classes/".$class.".class.php"; include_once $path; } this will also work.
Dude, fantastic explanation, you are a beast, congratulations
@JoaoPedro-dx6pn3 жыл бұрын
Ameeeeeen lol finally some good explanation about autoloading. Thanksss
@andrewcuster6498 Жыл бұрын
This lesson is great, and I still have 4 minutes left to watch... Wish I could give two thumbs up, It will really help clean up my code.
@fredpourlesintimes4 жыл бұрын
I didn't learn namespaces yet, but your explanation about classes loading is really great.
@islamsaied64845 жыл бұрын
one of the best i have ever seen god bless you
@techortrick30122 жыл бұрын
Thanks. Great teacher. Better than my college lecturar
@digital_mindmeld2 жыл бұрын
Nice to mention = that when you implement namespaces on the login system at the end of this course you need backspaces where you extend to dbh in the class root folder and every time you make a pdo call. Either that or you need to add dbh in every folder you use it and add the same namespace to it. (Saved you 30 minutes of figuring that out when u try to combine these two)
@halim61505 жыл бұрын
Thank you man, you put it very simply.
@rafaelmartineztomas49113 жыл бұрын
Thanks for the videos bro !! Have a good day!
@Alex_Heil4 жыл бұрын
if you’re having problems with the autoloader and namespaces this might help: change the $fullPath variable inside the myAutoLoader function to this: $fullPath = $path . str_replace('\\', '/', $className) . $extension; full code in autoloader.inc.php: spl_autoload_register("myAutoLoader"); function myAutoLoader($className) { $path = "classes/"; $extension = ".class.php"; $fullPath = $path . str_replace('\\', '/', $className) . $extension; if (!file_exists($fullPath)) { return false; } include_once $fullPath; } hope this helps ;)
@muzika50012 жыл бұрын
Omg, Alex! Thank you very much! You saved the night and headache! :)
@BneiAnusim2 жыл бұрын
$fullPath = $path . str_replace('\\', '/', $className) . $extension; fixed my issue. Thank you very much!
@sumanbd77 Жыл бұрын
Alex Heil Thank you so much.
@sumanbd77 Жыл бұрын
Same from myside also.
@M459633 жыл бұрын
Hi Dani, first of all, thank you so much on the effort you put to do this tutorial, because it's amazing and I can understand everything (I'm new on PHP so this it's really helpful). Additionally I want to make a suggestion about the order of this videos, because it would be great to put before the N°3. "Create Classes in OOP". Regards.
@SNikhill5 жыл бұрын
Your tutorials are just awesome. :)
@fullstackgreekdeveloper80334 жыл бұрын
For php 7.4 just add this line between $extension and $fullPath variable declarations : $className = str_replace("\\", DIRECTORY_SEPARATOR, $className);
@pixandcodes63334 жыл бұрын
I love all of your videos.
@germanduterte71105 жыл бұрын
Very clear explanation, thanks a lot
@zoynuldotcom3 жыл бұрын
Thank you brother, Great tutorial
@isaiahdaniel25225 жыл бұрын
Really love the new view, thanks Daniel
@patrickbroaden98204 жыл бұрын
Informative, usual....👍🏾
@ayatohigashi51133 жыл бұрын
Thanks for all this wonderful videos. You are awesome!!!!!
@ali-pc7nv6 ай бұрын
Brilliant as always
@electronicheartbreak.5 жыл бұрын
I am probably that early that the video isn't fully rendered to 720p quality :). Another nice tutorial.
@xanduong77804 жыл бұрын
thank you man. you save my life;
@warzhenaji63805 жыл бұрын
At 8:21 on lines 2-10, would it be wrong to place the function [spl_autoload_register('myautoloader')] AFTER the bit from line 4 to line 9? Would it ruin the logic, or would it run the same? Also, thanks Daniel. You're a life saver. This is the only coding tutorial resource that anyone should use on KZbin.
@collectorX Жыл бұрын
Thank u so much for the work.. that helps us a lot
@pythonsamurai4 жыл бұрын
I love this lector, thank you!
@mmohamedbadr2 жыл бұрын
Perfect ,Thank You
@Cortexikid5 жыл бұрын
Hi! Your video courses are so useful, I have already learned a lot from you, so thank you for your work! I have a question about the 'myAutoLoader' method, though. Kind of evident what is happening, there is only one part I couldn't comprehend, how does it know what the '$className' is? When do we give that parameter to the method? Thank you for the answer in advance! :)
@isaachatilima5 жыл бұрын
Great tutorials. When are you going to do Laravel?
@ademineshat5 жыл бұрын
Video quality?! Anyway, best video so far :)
@poovarasimurthy68524 жыл бұрын
your way of explanation is too cool and i can understand it clearly. I have a question to ask how can we call the inheritance child class name by this auto loader function thanks in advance!!!
@patrikTHELEGEND5 жыл бұрын
REMEMBER: If you call on static method or property (the ones where you dont need to initialize class) , instead of " new Person\Person " , simply put "Person\Person"
@kgkhant48854 жыл бұрын
Thanks bro :D
@achrafjammoussi83743 жыл бұрын
that is amazing ! thanks a lot
@theobellash64402 жыл бұрын
05:00 When is that future though??? One still use it
@chitrajha75755 жыл бұрын
You are a osammm teacher , Thank you so much for your videos
@sherkan_n5 жыл бұрын
I like your videos, i learn many of them.
@adeyemiadeshina39884 жыл бұрын
Thank you Dani!
@pragneshkatkar315 жыл бұрын
Hello Daniel, can you please discuss about navigation and routing?
@phil88995 жыл бұрын
Is it safe to include all the classes? Does it slow down performance or anything?
@SureshBhardwaj4 жыл бұрын
Thats great Dani! Just wanted to check how secure it is. Can a hacker break into the web server If I enable auto loading feature?
@mohammedissam36514 жыл бұрын
Man ur a life saver.
@stephenchen545 жыл бұрын
Hi, I am wondering are we supposed to set the file name as "Person.class.php" (with a capitalized "P" instead of a lower case "p"). When I use the "person.class.php" I got an error, while when it comes to "Person.class.php", the error disappeared. Thanks.
@pxjesse81285 жыл бұрын
To use the same capitalization as in the video, I added $className = strtolower($className); in front of the $fullPath variable in the autoloader. It's more of a workaround than it is a solution, but it's a start
@mrpddnos5 жыл бұрын
the paths are case sensitive. You either need to make spelling of your file names the same as the spelling of your class names or use strtolower() around $className in the myAutoloader() function. Example: $fullPath = $path . strtolower($className) . $extension; The best solution is consistent file naming. File names are recommended to be lower class. So it’s advisable to use the code in my example. Somehow you need to change the uppercase letters in the class name to lowercase in the file name. The example is how you do that.
@iulian12345664 жыл бұрын
for Windows - add strtolower($className) - because he named the file person.class.php and the class in it is Person. spl_autoload_register('myAutoLoader'); function myAutoLoader($className) { $path = "classes/"; $extension = ".class.php"; $fullPath = $path . strtolower($className) . $extension; if (!file_exists($fullPath)) { return false; } include_once $fullPath; }
@AsimYilan6 ай бұрын
thank u dude u rescure my life :D
@hamzaarshad96905 жыл бұрын
I was having problem in executing the code than I changed the name of my file containing the Class "Person" to Person.class.php and then the code started working. I don't know this will work in future or not but it is working for now
@DawoopFilms5 жыл бұрын
Oh thank you, I was having the same problem... was about to throw my pc through the window
@raylee1414145 жыл бұрын
@@DawoopFilms I have the same problem too, threw my pc through the window, just take back
@raylee1414145 жыл бұрын
btw, i found that the Person in the path actually follows that word when i call the class person1 = new Person in index.php
@marcelomiranda96233 жыл бұрын
Very good class my friend.
@prashanthkumar05 жыл бұрын
great 👍💗💗 please continue php
@Rii-Americano5 жыл бұрын
I love your tutorial
@hamzaarshad96905 жыл бұрын
Namespace sometime doesn't work if you leave any space before the php start tag "
@Lyrik-Klinge Жыл бұрын
That's it, THANKS!
@sinankayapinar Жыл бұрын
If you use namespace, your autoloader.inc.php page must be so: spl_autoload_register('myAutoLoader'); function myAutoLoader($className) { $path = "classes/"; $extention = ".class.php"; $fullPath = $path . $className . $extention; $fullPath=str_replace("\\","/",$fullPath); if (!file_exists($fullPath)) { echo $fullPath; } include_once $fullPath; }
@lalityadav536 Жыл бұрын
You are right Sinan by adding the statement $fullPath=str_replace("\\","/",$fullPath); removes the error "Fatal error: Uncaught Error: Class "Person\Person" not found in /var/www/html/". This error was occurring while I was using namespace in the person class.
@dirkrobbertse4503 Жыл бұрын
Thank you for adding this i was trying to figure it out...
@The-Great-Brindian3 жыл бұрын
Dani, put a book out. IF you have the time/energy that is. I know everything is 'digital' these days but trust me, there are some 'old-schoolers' like myself who still love a good 'Programming book' to read. Some of the best sources still are books, believe it or not.
@gamnguyen31165 жыл бұрын
Thank you so much!
@deepgagan90155 жыл бұрын
Hello sir, Thank you so much for the valuable tutorials. I used this autoloader function in my project. It was working perfectly on local host. but when I uploaded my project on godaddy online hosting. It is showing me fatal error like this file are not found in autoloader.php file. Why i am having this issue on hosting not on local host?? Thanks in advance
@lifeslittleescapes4 жыл бұрын
Nice ending...for those who jumps at the middle and confuse all...😂😂😂
@gololacharles31104 жыл бұрын
Dear mmtuts, I used this tutorial and included the automatic loading of classes to my Project, It worked fine on the localhost, Unfortunately its failing after moving the project to an online server. Kindly advise me. Thanks
@ApplicableProgramming4 жыл бұрын
I assume your online server is linux and you are developing on windows? Check if files are capitalised properly, as on linux MyClass.php is not the same file as Myclass.php (not the capital C)
@abiodunakinwande165 жыл бұрын
thank you for this video.
@brinishbritto57814 жыл бұрын
If u r still facing the issue, then do this : inside classes/include.class.php spl_autoload_register('myAutoloader'); function myAutoloader($className) { include_once(dirname(__FILE__) . '/'. strtolower($className). '.class.php'; }
@mlawalkthrough5 жыл бұрын
Thank you. Please more advanced php oop lessons.
@محمدحمدي-و7ح7ح10 ай бұрын
thsnks a lot Dani
@ForeverXDful4 жыл бұрын
your videos are the best. can you take a video about Composer?? It would be great.
@MHdeJong875 жыл бұрын
really nice tutorial! thank you so much! One question about something I not totally understand: In autoloader.inc.php you only "open" the php script with "" ?
@mrpddnos5 жыл бұрын
You only have to close php in a file where you use php along side something else (like html). When a file is purely php the php interpreter closes php automatically. No need to do it yourself.
@Happystoreup5 жыл бұрын
Thank you!
@dgloria Жыл бұрын
Hi Dani, how does the spl_autoload_register knows which files to load? I don't see the Person/House explicitly passed on, or a foreach for every file in the repo. Thank you
@johnnguyen16555 жыл бұрын
I wonder where and how to pass value to the $className variable in autoloader. in the video the actual value is 'class' but how PHP to understand that. Let say we name files with something like somename.notclass.php, does it work?
@kvazaios50264 жыл бұрын
yoooo thats what I was thinking about, its like magic
@Kallas134 жыл бұрын
when the myAutoLoader method is called it actually uses the word you typed when you instantiated the object. so let's say it is $person1 = new Person(); , it will use "Person" as $className. You can see this by echoing $fullPath or by having the filename be different than the class name, causing an error. He did briefly show this when he changed Person in the index.php file to Persond.
@noiononfiniscosennoquestid68105 жыл бұрын
Login system using PDO?
@edumaba Жыл бұрын
Hi Dani, thanks for this awesome tutorial. For my autoloader code to work I had to convert the $className variable to lower case for it to work. Another way was to rename the person class file to "Person.inc.php". Yours worked without doing that, how?
@bilalbeny4172 Жыл бұрын
so powerful video
@pbdaemon5 жыл бұрын
hi your next videos contains register and login with pdo?
@a-ezzat56773 жыл бұрын
what if my class has constructor arguments . how would spl_autoload works, am i have to play a trick with optional args within the function either
@alexfraser22145 жыл бұрын
Why include_once apposed to include ?
@seunalegbeleye27465 жыл бұрын
Hi mmtuts, I recently worked on fintech project in which several of your videos empowered me to do it. But i have a question: I noticed that in some fin-tech websites, when you view their page source to check the front end code, you won't see the value of the form's action e.g=> action=" "-- but in my own project it appears. I think not appearing is a good security measure. Please how can i make my form' action value not to show when someone view its page source.