From the course: Learning PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Printing on the screen
- [Instructor] The most common task you'll perform in php is printing stuff on the screen. After all, your main goal is to create dynamic websites. The simplest way to print something out on the screen is to use a php echo statement. So I'll write my php opening tag, which is the less than sign, a question mark and then the letters php and then on a new line, I'll write echo hello world. Then I'll close my php tags. Echo tells php print out whatever follows this word. You can also see that there are single quotes around hello world. There are nuanced differences between a single and double quotes that you'll learn about later. Finally, this statement ends in a semicolon. This will be the case most of the time and you'll learn what the exceptions are later, but know that if you see an error, you may have missed a semicolon. There are a few other ways that you may see information printed in php. There's the shorthand…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
How PHP works2m 29s
-
(Locked)
Printing on the screen3m 53s
-
(Locked)
Using variables6m 40s
-
(Locked)
Single vs. double quotes7m 3s
-
(Locked)
What are arrays and how do they work?3m 56s
-
(Locked)
Defining arrays8m 10s
-
(Locked)
Challenge: Display basic information on an HTML page36s
-
(Locked)
Solution: Display basic information on an HTML page2m 57s
-
-
-
-
-
-
-
-
-
-