PHP-and-MySQL/C2/Echo-Function /English

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
0:00 Hi and welcome to a basic PHP tutorial.
0:03 I'll just go through how to use the "echo" function and how to set up your tags .
0:08 Those of you that are familiar with "html" will know that there are html tags to start your page and to end your page.
0:15 They're not vital in an html page. As long as you've got an html extension, you're fine.
0:20 However, in PHP, you need the tags. This starts and this ends.
0:25 That's basically the standard notation for it.
0:29 However, our content goes in between here.
0:32 Now, I've already saved my file as "helloworld.php".
0:36 So, let's save that and have a look in here.
0:41 Okay, there's nothing in the page at the moment but we've got our page set up. It's absolutely fine.
0:47 The "echo" function works like this: we've got echo, we've got some double quotes and we've got a line terminator which is the semicolon mark.
0:57 And our text goes in between here. Let's save that and we'll refresh. And there we go.
1:05 Right, you can – and I find this very useful – write your "echo" function like this.
1:10 Because when you put an html code inside your echo function (and just to let you know, if you haven't learnt html yet I suggest you pick it up, at least the basics, because we're going to be using it quite a lot) these bits here don't represent line breaks.
1:22 For that you need to add your own html in. So '
' for line break and then 'New line'.
1:28 We'll refresh this and there you go! Our html has been incorporated.
1:33 Okay, just to let you know, this is one thing that a lot of people run into: 'image source equals' and your file goes there.
1:42 However, at the moment we've got 'echo'.
1:46 This shows that we're going to start our output and this here will show that we're ending our output.
1:52 We don't end it here; we're going to end it here.
1:55 So instead of these, we'll need inverted commas.
1:58 Basically, that will let us show our image there.
2:02 There's no file specified, but you get the picture.
2:05 So, let me just show you what would happen if we keep these in and then with that I'll end the tutorial.
2:13 Right, we've got 'Parse error'.
2:15 We either need a comma or a semicolon to end, which proves that as we're coming up to here, we need a semicolon after this.
2:23 But in actual fact, that's not true.
2:25 So, just keep them as inverted commas.
2:30 Okay, that's the basics of the echo function and the PHP tags. Hope you enjoyed learning them.
2:34 Thanks for watching! This script has been translated by ---------------------------(translator's name) and this is -----------------------------------(narrator's name) signing off.

Contributors and Content Editors

Chandrika