Including files allows developers to stay organized and to reuse code instead of repeating it. Learn the differences between include, require, include_once, and require_once in this video.
- [Narrator] One useful feature in PHP…is the ability to include code from other files…into a PHP page.…It's an important feature because…it helps us to stay organized,…and to not repeat ourselves.…For example, if we define a function…that we want to use on one webpage of our site,…and we need to use it again on another page,…we don't want to copy and paste that a second time.…That would mean that we now have…two versions of the function,…and if we find a bug or we make an improvement,…we have to remember to update the code…in more than one place.…That leads to bugs and code that's hard to maintain.…
It's much better if we can put that function…in a single file, and then load it in to both PHP pages,…so that they're using the same version…of the function all the time.…And remember, that's the main reason we create functions,…is to have reusable code.…The way that we can do this in PHP…is by using the include function.…So inside our PHP tags we use include,…and then the file name that we want to include.…Functions are probably the most common thing…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.