Codecademy.com — курс PHP — урок 2

Звенит звонок, начнем урок… Итак, урок 2, на котором дано:

«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.

и даже добавлено задание:

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.

(добавь, мол, дорогой, в строку 8 текст «My first line of PHP!»)

Исходный код для работы представлен ниже:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>
<?php
echo «»;
?>
</p>
</body>
</html>

Немного помудрив, получаем следующее:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>
<?php
echo «My first line of PHP!»;
?>
</p>
</body>
</html>

Скрин, как всегда — ниже … а пока запомним: что бы вывести какую-либо информацию в PHP — используем echo

php-lesson-2