Skip to content

Why Learn PHP?

Nolen Felten edited this page Feb 4, 2016 · 1 revision

"So what?" You might say. "I can do that with JavaScript." And that's true! But JavaScript's knowledge can be limited.

JavaScript generally runs in the browser, or client. This means it only really knows what's going on in your browser, plus whatever information it gets from the website(s) you're connecting to.

PHP, on the other hand, runs on the same computer as the website you're visiting, which is known as the server. This means that it has access to all the information and files on that machine, which allows it to construct custom HTML pages to send to your browser, handle cookies, and run tasks or perform calculations with data from that website.

Instructions We've written a little PHP in the editor to the right, but it's not complete! On line 8, type My first line of PHP! between the ""s.

<!DOCTYPE html>
<html>
	<head>
	</head>
	<body>
		<p>
		  <?php
			echo "My first line of PHP"; 
		  ?>
		</p>
	</body>
</html>
Clone this wiki locally