How To Include Files In PHP - Include and Require - Full PHP 8 Tutorial

  Рет қаралды 53,927

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 113
@henrik9173
@henrik9173 3 жыл бұрын
Learning something new in every video. These are gems!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you. Glad you liked it 🙌
@ouriil
@ouriil 10 ай бұрын
Really there is no other php course like this anywhere online either free or paid..congrats sir professor FOR IN DEEP PRESENTATION OF PHP
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Thank you 💙
@lotuslando1994
@lotuslando1994 2 жыл бұрын
That was a very thorough and clear explanation about how to include files. I am learning SO MUCH from each video. 👍👍 I don't think a thousand thank yous would ever be enough to acknowledge all the time and effort that you've put into these training videos.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Very happy to hear that. You're welcome & for me the biggest motivation is exactly this that you & many others are learning & finding my videos useful. So thank you
@Kanmiragi
@Kanmiragi Ай бұрын
Whatever made me think I had mastered PHP! Respect, brother, respect!
@ProgramWithGio
@ProgramWithGio Ай бұрын
Always something to learn. I also learn new things with PHP even after many years of working with it
@mehmetalikaba
@mehmetalikaba Жыл бұрын
You are the best teacher I have ever seen online! Please upload new videos about other programming languages too.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you
@adoughdough
@adoughdough Жыл бұрын
Okay now, I must confess this tutorial is really good. The instructor uses succinct and straight-to-point approach to explaining things so the student ends up learning all the way. Gio has no idea how very grateful I am, as in like "ki lo de!" Thank you so very much. I recommend this tutorial for anyone interested in learning PHP.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
This is awesome to hear, thank you & happy to hear that you are finding these lessons helpful
@benderbg
@benderbg 6 ай бұрын
It takes between 1-2h to chew through 8 min of this video. So much info. This video alone is 5.5 A4 pages with all the code samples. Thanks for great content.
@ProgramWithGio
@ProgramWithGio 5 ай бұрын
Glad it was helpful
@lairotuT-Tutorial
@lairotuT-Tutorial 3 ай бұрын
Lol, I'm glad to see that there are others that take notes from this course, I felt kinda old style when I started :-) But its soo much info^^
@Armando-px8hi
@Armando-px8hi Жыл бұрын
Actually I was just thinking if there is any other one who is better in PHP than you.The BEST💯🙌👏
@ProgramWithGio
@ProgramWithGio Жыл бұрын
There are many that are way better than me, but thank you 🙌
@Armando-px8hi
@Armando-px8hi Жыл бұрын
@@ProgramWithGio I do not think so🙌👏
@iambasanta
@iambasanta 3 жыл бұрын
clean explanation. This is the best and legit PHP tutorial ever. Thank you .
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Glad it was helpful. Thank you
@gazianis7572
@gazianis7572 3 жыл бұрын
i am starting to watch your 70 videos more & more times
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
This lesson helped me a lot. Thanks a million!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear
@ilya_123__
@ilya_123__ Жыл бұрын
i finally have understood the difference between include and require )
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's awesome, happy to hear
@rakibulhasan8749
@rakibulhasan8749 Жыл бұрын
I learned a lot in this tutorial . I didn't know how to assign include file value in a variable and modify the content . Thanks
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear that 🙌
@nyinyiandnyinyi
@nyinyiandnyinyi 9 ай бұрын
the best tutorial for beginners.
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
Thank you 💙
@petruciucur
@petruciucur 2 жыл бұрын
New and profound things with each lesson. What is true (include()) for NAV is also true for HEAD and at the end of the page, for different styles and scripts
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hey, sorry for the late reply. Not sure I understand the question. Can you elaborate?
@lairotuT-Tutorial
@lairotuT-Tutorial 3 ай бұрын
@@ProgramWithGio I guess that comment was just to add to your teaching that not only a nav-file can be extracted and included but head-file and footer-file as well. Of course EVERY file can be added.
@zoemoorton9570
@zoemoorton9570 3 жыл бұрын
Thanks! Worked well for me :)
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome
@abdelrahmanyosry9185
@abdelrahmanyosry9185 2 жыл бұрын
i really love this course i never watch some one explain everything about any other language like you. thank you so much
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙
@prajwalsiwakoti9866
@prajwalsiwakoti9866 2 жыл бұрын
Excellent. Man, i am loving it . God bless you Gio
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@oghenevwefepeace2501
@oghenevwefepeace2501 2 жыл бұрын
You are awesome. God bless you. I keep learning more and more after each video
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@derry_yeh
@derry_yeh 3 жыл бұрын
these videos are legit. Brilliant stuff
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you
@amgedalaa1831
@amgedalaa1831 2 жыл бұрын
thank you're really a great person, i got complicated from PHP output control functions because i searched for it after you used it in the video and i couldn't understand somethings it was complicated so i wish you will upload a video for it soon 😅
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙
@viktore.degray3259
@viktore.degray3259 28 күн бұрын
damn you had me with the lets go to goto statements though i missed a part XD
@ProgramWithGio
@ProgramWithGio 26 күн бұрын
:D
@anilgajiev8257
@anilgajiev8257 3 жыл бұрын
გიო, გაიხარე! Including/rendering a separate component dynamically is much easier with php that with ejs. Nice one.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌 მადლობა
@GeneraluStelaru
@GeneraluStelaru Жыл бұрын
It's even easier in Svelte or any other JS framework for that matter. I haven't delved too much into PHP but if that's how it handles dynamic page generation, then it should be relegated to backend logic only.
@emekatimothyiloba699
@emekatimothyiloba699 Жыл бұрын
Great Tutorial
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙌
@p3tmalu1235
@p3tmalu1235 Жыл бұрын
Damn, this is a gem. thank you My Dear Sir...
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙌
@lairotuT-Tutorial
@lairotuT-Tutorial 3 ай бұрын
Always a pleasure to have these deep dives into the elements of PHP! Best tutor Gio! In the beginning require and include kinda confused me (I'm often confused, am I? 🧐) A small point I missed and that could be helpful is the mixture of require, include and require_once, include_once. I guess its often result from copy pasting of other peoples code. In only few cases it really makes sense but often it makes no problems. Thats possibly why people stick with it. Maybe I'm too old but I like when (especially if you have many options - and PHP could have the title "many options language") you program by reason and not random. Am I right when I assume that always using require_once could be a good strategy and only when your code either shows "I need it a second time" and/or "Its nice to have it, but its not strictly required" switch to one of the other options? I do something similar with "private" and "protected"/"public" later on in Objects.
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
Yup, I also use require_once most of the time
@jessieren6476
@jessieren6476 3 жыл бұрын
Learning a new tip today : . Thank you sir
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
That's great. You're welcome
@dancarter6044
@dancarter6044 2 жыл бұрын
.
@ballpen9157
@ballpen9157 Жыл бұрын
great video. thank you.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks
@RedBaron19180
@RedBaron19180 2 жыл бұрын
this is the best php tutorial i have ever seen thank you for everything gio (by any chance are you georgian? :d)
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙 and yes I'm Georgian 🙂
@RedBaron19180
@RedBaron19180 2 жыл бұрын
@@ProgramWithGio shemogevle gio seriozulad karg videoebs deb mitumetes dzalian momwons patara detalebzec rom laparakob romelsac sxvagan yuradgebas ar utmoben.warmatebebi da kidev ertxel didi madloba am umagresi videoebistvis ❤️
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@RedBaron19180 გაიხარე, მიხარია რომ ქართველებიც უყურებენ ჩემ ვიდეოებს 🙌🙏
@RedBaron19180
@RedBaron19180 2 жыл бұрын
@@ProgramWithGio aucileblad yvelas shevtavazeb am videoebis yurebas da movematebit :D
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@RedBaron19180 🙏🙏
@ziadsraya
@ziadsraya 6 ай бұрын
Thank you so much
@ProgramWithGio
@ProgramWithGio 5 ай бұрын
You're most welcome
@aswadali5139
@aswadali5139 2 жыл бұрын
If you are going to learn PHP in 2022, This course is for you.
@ilya_123__
@ilya_123__ Жыл бұрын
thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome!
@yarik83men51
@yarik83men51 3 жыл бұрын
Like You lessons. Thnx
@aweisabdi6947
@aweisabdi6947 3 жыл бұрын
you helped me thnks sir
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Glad to hear that, you're welcome
@CarlosOrtiz-sz2pp
@CarlosOrtiz-sz2pp 2 жыл бұрын
Thank you
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome
@sreneilif
@sreneilif 11 ай бұрын
Hi Gio - One question to include and require - when I do 2 include/requirelines like this include_once 'includes/layout.inc.php'; include_once 'Classes/Database.php'; the top of my page (the first line gets empty and Nav bar in my else working bootstrap theme get pushed downwards... if I add 3 include/require et moves down 2 empty lines. I thought it would be a good idea to include from different files, depending of what I need, like in my example one file for database and one for layout... Question: is it my bootstrap that messes up or isn't it possible to include different pages? I tried with all 4 include/require functions. Love your lessons, though they are very fast - good we can rewind and push pause!!!
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Most likely related to content/whitespace within your layout & other php files being included. I would need to see your setup to be able to help
@IonizedComa
@IonizedComa 8 ай бұрын
Its amazing how php has default functionality when other languages like js and python would need entire frameworks to do this
@ProgramWithGio
@ProgramWithGio 7 ай бұрын
Yea PHP is amazing & once you get to full stack frameworks like Laravel you'd be amazed how much functionality comes in built in
@godmansarah
@godmansarah 2 жыл бұрын
This is great, although maybe your `require_once` demo would be even more effective if you had kept the first call as `require`.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌. It would have the same effect.
@godmansarah
@godmansarah 2 жыл бұрын
@@ProgramWithGio Yes exactly - some people though might think that you need to put it on all require calls for it to work, not just those after the first call. 🙂
@patel5532
@patel5532 2 жыл бұрын
Great tutorial as always. Could you explain how str_replace() function change the content and what if file has multiple similar name then how str_replace() function work?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
str_replace just replaces all occurrences of the search term with whatever you give it. There are more examples here: www.php.net/str_replace
@mimoh2000
@mimoh2000 2 жыл бұрын
Really nice tutorial. My question is on the str_replace(). Notice it's also changed the url from 'about.php' to 'About Us.php', which the give 'file not found' error. Any work around solution to this. Once more, thanks.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
str_replace is case sensitive as far as I remember so it should only replace 'About' with 'About Us' it wouldnt replace 'about' lower case version. Try it out.
@mimoh2000
@mimoh2000 2 жыл бұрын
@@ProgramWithGio yes absolutely correct. The str_replace() is case sensitive. Replacing 'about' with 'About us' always changes the URL. The first parameter is case sensitive. From what I understand the str_replace() takes 3 parameters. First, the string you want to be replaced. Second, the required string and third, the variable that holds the string. In whichever way, it always changes the URL.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@mimoh2000 I just tried it: 3v4l.org/8K4oM and it works as expected, maybe I'm missing something?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Here is the snippet with the exact nav: 3v4l.org/13noQ as you can see in the result it does not update the url.
@MobiusCoin
@MobiusCoin Жыл бұрын
Did we cover ob_ stuff in detail yet? I feel like I'm missing something.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Do you have any specific question about it? We do use it again later in the course when we get to views
@subish20me
@subish20me 2 жыл бұрын
when using require two times in a same file i got redeclare error but didnt got it with require_once... but theres no error in ur side what might be the reason
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
require_once only includes it once, but with require, it would cause the error if you had a function in the file for example. If you are referring to the example at 2:15 there it's just an echo statement so nothing is being re-declared, if I had function, for example, it would cause an error.
@Vickey51193
@Vickey51193 10 ай бұрын
Awesome video but "Don't worry about this now"---
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Yes because we cover it later in the series.
@rxxt-sh1vj
@rxxt-sh1vj 2 жыл бұрын
Bro as stated in last example If i take contents of a php file and inject it inside HTML file against a placeholder {{content}} inside body tag using the functions ob_start( ) and ob_get_clean( ) as you showed in the video in the last this is my practice.php file -------------------------------------------------- $x = 5; function foo(): void { global $x; echo "Hello $x"; } foo(); Expected output -- Hello 5 Getting the output as --Hello In the output I loose 5 .Does using a function as a string and injecting it in the layout makes it loose content in case of Global Scope? In rest of the cases I am getting expected output. Need your suggestion
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Never use global, its not a good practice, most likely whats happening is that global $x is redefining variable without value.
@rxxt-sh1vj
@rxxt-sh1vj 2 жыл бұрын
@@ProgramWithGio I am practicing your entire PHP course video by video so this is the same example as you gave in video 1.23...:D Anyways I am in love with your PHP video series it has improved my knowledge a lot and has made me learn a lot more concepts...even some things I had never seen anywhere or heard of...Also shows exceptional effort you have put in your videos for including all sorts of content...:D
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@rxxt-sh1vj ah didn't realize you were using my example. In that video I was just showing it to illustrate an example, globals shouldn't be used in modern PHP, it's good to know what it is and how it works in case you are working on a legacy codebase. Thanks alot, I'm really glad that you like my videos.
@NirajDhakal
@NirajDhakal 2 жыл бұрын
This is where @blade directives can be parsed
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Yes but we are not working with Laravel or blade
@prabu2778
@prabu2778 3 жыл бұрын
Thanks sir Where are you from sir
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome. I live in the U.S. but originally from country Georgia
@prabu2778
@prabu2778 3 жыл бұрын
@@ProgramWithGio I am very happy to get reply from you Thanks for your support
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
@@prabu2778 You're welcome, thank you for the support as well
@illegalsmirf
@illegalsmirf 2 жыл бұрын
You didn't say anything about goto statements 😞
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That was the point 😁. You don't need to know it, don't use it.
@illegalsmirf
@illegalsmirf 2 жыл бұрын
@@ProgramWithGio hahaha that’s good 😸
@christiansosa5484
@christiansosa5484 Жыл бұрын
xD
@ProgramWithGio
@ProgramWithGio Жыл бұрын
🤔🧐
@arturlinnik2128
@arturlinnik2128 9 ай бұрын
Wait wait wait, are you really saying that if I include a php file into another I automatically have access to the variables and functions and that it can also overwrite the variables I have declared in my original file? What kind of dumb implementation is this? Wtf php??? Am I missing something??
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
Yes that can be considered a good or bad depending on how you look at it. It comes in handy for templating engine implementations & there are some other use cases but in general yes it can be tricky to work with which is why I avoid having variables defined in files that are being included in other files. Once you start using OOP & proper templating this shouldn't be a concern
PHP Return, Declare & Tickable Statements - Full PHP 8 Tutorial
6:51
Program With Gio
Рет қаралды 48 М.
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
I built an app using a single index.php file, here's how it went
32:42
Andrew Schmelyun
Рет қаралды 91 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 83 М.
PHP 8.4 Is Good
15:18
ThePrimeTime
Рет қаралды 137 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,3 МЛН
PHP Switch Statement - Switch vs if/else statement - Full PHP 8 Tutorial
8:10
PHP Front To Back [Part 9] - Include & Require
8:23
Traversy Media
Рет қаралды 85 М.
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН