[MUSIC PLAYING] DAVID J. MALAN: All right. This is CS50. This is the start of week eight. And you may recall that we left off last time looking at a new language altogether. In fact, one that's fairly lightweight and it's not even a programming language. It's a markup language that lets us actually structure and make web pages. And when you something else in conjunction with this-- or you soon will, if you haven't already. We're going to use Cascading Style Sheets, or CSS, which is another type of language with properties and values that's going to let us do things like change the color and change the position and these kinds of tweaks. But today and onward, we start to focus on more powerful languages, actual programming languages like PHP. So PHP has been around for some time. And as you'll see, it was designed primarily early on for actual use in web development and actually generating web pages. So what kinds of features does a language need in order to make web pages dynamically with it? In other words, if you want to generate content dynamically-- like Facebook's Newsfeed, which changes constantly, or instant messages that pop up from time to time-- like what's the key piece of functionality you need in a programming language that would let you dynamically print new information to the screen? STUDENT: Code. DAVID J. MALAN: Code. OK. We'll take that. A little more precise. I mean, we could do this with C, frankly. It would be a pain in the neck. But-- is this commitment? STUDENT: Yeah. Variables, maybe? DAVID J. MALAN: Variables. OK, sure. Variables can certainly help us out. And even something simpler. We used it in the very first program of the very first day when we actually said "hello world." STUDENT: Print. DAVID J. MALAN: Print, right? Print, or printf in the world of C. So all this time, we've had at our disposal a language-- C, in particular-- and even Scratch for that matter that can generate strings of text. Well, if HTML, as we saw last week, is just a whole bunch of strings of text albeit with open brackets and closed brackets and some kind of rhyme and reason behind it, well then we could really start generating web pages either manually by typing them out in gedit or in Microsoft Word, for that matter-- we just need a text editor. Or we could write code, to your suggestion earlier, that would let us dynamically generate HTML, and that's what we're going to start doing with PHP and ultimately even with a language called JavaScript, is use one language to generate another. And indeed, this is what Facebook and many, many other sites do to actually dynamically display new information to you. So let's begin with this-- a cryptic looking line, but one that's actually pretty powerful. Thus far, we've been using C, which is a compiled language. And just a quick recap-- a compiled language has what characteristic? You obviously need to compile it, but what does that mean? Yeah? STUDENT: It needs to be assembled into machine code. DAVID J. MALAN: OK. It needs to be assembled into machine code. So you take your source code, which is sort of English-like. You convert that to something lower level, which is ultimately called object code-- 0's and 1's. And it's those 0's and 1's that a CPU, like those made by Intel, actually understand. Now, PHP and Python and Ruby and JavaScript and bunches of other languages are not compiled languages but interpreted languages, which means you just type them and then you don't turn them into 0's and 1's. You instead just provide then as input to someone else's program, called an interpreter. And that person's program has been designed to understand what each and every symbol in Python or PHP or Ruby or any number of other languages means. And so all we need is something like this. So in fact, I'm going to go over to the appliance here, just into any old window, and we're going to go ahead and open a file called, say, hello. Now previously, I might have saved this even with a file extension, but I'm going to do something even simpler here. I'm going to go ahead and start this file with this cryptic syntax. So "user, bin, env, for environment, php." This is simply one line of code that's going to tell my operating system, go find in your local environment whatever that is, wherever PHP is-- the interpreter-- and go ahead and use that interpreter to interpret the following code. Now, this is kind of an ugly feature of PHP. But in this language, any time you write PHP code, you need to have one of these ugly PHP tags demarcating the beginning of your code--