Great video, as usual! It could have been a great opp to introduce shorthands tho - unless you already made a video about it already. Anyway, thanks for what you do! We need to keep PHP alive :)
This advice is so helpful my friend! Thanks for sharing this. I don’t get why ppl are complaining about your „errors“, as this video is about explaining a concept, not a specific piece of code. 😅
Obviously there are sometimes cases where a small amount of nested conditionals are probably going to be perfectly fine, but for the most part, this method works really well.
I know it's just a quick demonstration of the concept, but I would think that you would want to test if the SERVER variables were empty, as trying to assign them when they are not there would get errors. I know, because I have had that issue with my own code previously.
You are amazing teacher. Please make a video of how to build php for backend and javascript for frontend together as a fullstack, so we could know how frontend and backend integrates .... There are very few videos out there, that have both js and php included project.
Keep your code lean and mean. Negation is key here 🙂 I always say to friends & family, don't be so negative, but if you're actually in coding mode, you want to be very negative at times.
Most nesting, in C/C++, is actually from maintance mode, where the desire, is to change the code the least, but have the new condition. After a few years, you'd added 20+ more conditions (lol). There is one piece of code I remember, that had no validation. The validation occured before it was called. But then things changed. After three years, I'm looking at 3 years of trivial changes, thinking, I would not have done it this way from the beginning. I added a java validation external program, and left the damage in place. But, it got weird. One week at a time. 600+ companies exchanging files, and someone can argue the definition of zero.
Hi Dani, once again a great video - I know I'm late but I'm reviewing what you did the last years and it is a pleasure!!! I am one of those nesters indeed and I wonder what to do when "if-elsing", what I commonly do when my nesting "happens". My workaround commonly was to extract such nestings into decision-functions. Often this can be useful as similar decisions can be made at several spots inside a project. Is there a way to jump right to the else condition? From my old C-programming times I remember people telling me that jumping points are no good way to programm. I guess thats only if you jump forth and back, do you agree? Best Christian
Dani, can you do us a file / image upload, retrieve, delete and update system in php on a live server? I think this almost doesn't exist on youtube. Consider it please. You are a great teacher again.
Would it make sense to create external validation classes for certain conditions, that could eventually move to a parent class to make them accessible elsewhere?
I have a legacy project built using a "true Indian coding guidelines": with a nesting level up to 6, and files length up to 5000-8000 lines (20-40K). I hoped, you'll show some ingenious "hack" to solve the nesting ifs' problem, I can utilize, but unfortunately, I know "the catch" which is on your video for quite a time :)/
How about create a different function that pass those arguments, I think that is better for readability and inclusivity of the code, you could also reuse those functions
But by this implementation we introduce duplicates in the code for each curly block about the header and exit. It will be very helpful if you give me another solution for the duplicate removal for sem implementation
I don't even understand this code... I think it will cause redirect loop (in case of GET request), because the script is already runs in index.php file.
Dani I guess you forgot to delete the exclamation mark(s) on line 12
Yup I did 🙂 🫣
@@Dani_Krossing hey i love your videos btw, thanks for teaching!!
The best php teacher thanks alot mr dani complete please and upload more videos
Great video, as usual! It could have been a great opp to introduce shorthands tho - unless you already made a video about it already. Anyway, thanks for what you do! We need to keep PHP alive :)
Back to PHP. You are a great teacher sir! Well done sir
Early returns are great! ❤
Next level, thanks a lot!
As usual very interesting, THANK you!
Thanks for the comment 😊
This advice is so helpful my friend! Thanks for sharing this. I don’t get why ppl are complaining about your „errors“, as this video is about explaining a concept, not a specific piece of code. 😅
Your videos are always so informative and well-presented. Thank you for sharing your knowledge with us!🚀😎
Obviously there are sometimes cases where a small amount of nested conditionals are probably going to be perfectly fine, but for the most part, this method works really well.
I know it's just a quick demonstration of the concept, but I would think that you would want to test if the SERVER variables were empty, as trying to assign them when they are not there would get errors. I know, because I have had that issue with my own code previously.
You are amazing teacher. Please make a video of how to build php for backend and javascript for frontend together as a fullstack, so we could know how frontend and backend integrates .... There are very few videos out there, that have both js and php included project.
Keep your code lean and mean. Negation is key here 🙂 I always say to friends & family, don't be so negative, but if you're actually in coding mode, you want to be very negative at times.
I wouldn't recommend using empty as it takes falsly values as empty (0, 0.0, null, false, etc..) but I get what you're trying to show of course.
What do you recommend using then please?
@@EfeAsikause isset or ?? operator
@@Aantonya thank you
Thnx for this amazing video , Can you explain us that how can we do an image and a video upload , insert , delete , select from database
Most nesting, in C/C++, is actually from maintance mode, where the desire, is to change the code the least, but have the new condition. After a few years, you'd added 20+ more conditions (lol). There is one piece of code I remember, that had no validation. The validation occured before it was called. But then things changed. After three years, I'm looking at 3 years of trivial changes, thinking, I would not have done it this way from the beginning. I added a java validation external program, and left the damage in place. But, it got weird. One week at a time. 600+ companies exchanging files, and someone can argue the definition of zero.
Hi Dani,
once again a great video - I know I'm late but I'm reviewing what you did the last years and it is a pleasure!!!
I am one of those nesters indeed and I wonder what to do when "if-elsing", what I commonly do when my nesting "happens". My workaround commonly was to extract such nestings into decision-functions. Often this can be useful as similar decisions can be made at several spots inside a project.
Is there a way to jump right to the else condition? From my old C-programming times I remember people telling me that jumping points are no good way to programm. I guess thats only if you jump forth and back, do you agree?
Best
Christian
Awesome❤
Dani, can you do us a file / image upload, retrieve, delete and update system in php on a live server? I think this almost doesn't exist on youtube. Consider it please. You are a great teacher again.
3;48 From what I have read from multiple Website, Die and Exit are basically the same
3:48 No, exit and die are exactly the same like aliases. In other languages they differ, but not in php.
Would it make sense to create external validation classes for certain conditions, that could eventually move to a parent class to make them accessible elsewhere?
Nice
Dani, there is an error in the code: we need to check if empty, not if is not empty
Yes 🙂
I have a legacy project built using a "true Indian coding guidelines": with a nesting level up to 6, and files length up to 5000-8000 lines (20-40K).
I hoped, you'll show some ingenious "hack" to solve the nesting ifs' problem, I can utilize, but unfortunately, I know "the catch" which is on your video for quite a time :)/
Thanks ❤
How about create a different function that pass those arguments, I think that is better for readability and inclusivity of the code, you could also reuse those functions
Sir, do you have something against birds??
If I'm not allowed to nest then I can not make mini 🦅 😢
Callback hell is just as worse 😂
But by this implementation we introduce duplicates in the code for each curly block about the header and exit. It will be very helpful if you give me another solution for the duplicate removal for sem implementation
The duplicate is done on purpose, since it allows us to include separate error/success messages into the URL, when we send the user to a page.
Tomato, tomahto!lol! BTW if it's '!empty', why would you want to exit!?!
Forgot to change that after I changed the example 🙂 Should just be empty()
@@Dani_Krossing I figured that's what you meant!lol! Love the channel, keep up the great work!
In the line 3, shouldn't you use another set of brakets after the exclamation mark? if(! ($_SERVER ..... === "POST"))
Or simply use !==
I don't even understand this code... I think it will cause redirect loop (in case of GET request), because the script is already runs in index.php file.
Not making value really because this is not valid to brock the code flow like writing exit or die you should end you code in end of function 😮
you are wrong, you need more nesting.
if {
if {
if {
foreach( ifLoops as ifLoop) {
while(ifLoop === 'true') {
if {
}
}
}
}
}
}
😮 I have been blind, but now I see!
code is clean but not secure. nest is more secure.
12