Join Kevin Skoglund for an in-depth discussion in this video Constants, part of PHP Essential Training.
- [Instructor] We started off this chapter…by talking about variables,…so it's fitting that we're going to end it…by talking about constants.…As you can guess from the name,…a constant is the opposite of a variable.…A variable can change or vary,…a constant can't change.…It remains constantly set at the same value.…Constants are going to be recognizable in php…because they're always written in all capital letters…and there's no dollar sign in front of them.…They're also going to differ from variables…in another way.…The only way to set a value for a constant…is to use a function, the define function.…You can't just use the equal sign to assign a value…like you can with variables.…
Let's try some experiments.…I'm going to open up basic.html…and then we'll just do save as,…and we're going to call this constants.php.…Here's the title here to constants,…and let's give ourselves a php block.…Now we know how variables work.…Let's say we had $max_width = 980;…that would be a variable set at the integer 980.…But if it was a constant,…
- What is PHP?
- Embedding PHP code on a page
- Inserting code comments
- Variables, strings, arrays, and Booleans
- If, else, and elseif statements
- While and for loops
- User-defined functions
- Function arguments and return values
- Debugging and troubleshooting
Skill Level Beginner
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. PHP Overview
2. First Steps
3. Explore Data Types
4. Control Structures: Logical Expressions
5. Control Structures: Loops
6. User-Defined Functions
- 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.