Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Your First PHP Code
Nov 02, 2017 @ 12:34:02

On the SitePoint PHP blog there's a new post from author Tom Butler that starts from the very beginning and shows you how to write your first PHP code. The article is an excerpt from the SitePoint book PHP & MySQL: Novice to Ninja, 6th Edition.

PHP is a server-side language. This concept may be a little difficult to grasp, especially if you’ve only ever designed websites using client-side languages like HTML, CSS, and JavaScript.

A server-side language is similar to JavaScript in that it allows you to embed little programs (scripts) into the HTML code of a web page. When executed, these programs give you greater control over what appears in the browser window than HTML alone can provide. The key difference between JavaScript and PHP is the stage of loading the web page at which these embedded programs are executed.

At this point they assume you've already set up the server to allow for PHP execution. They then provide an example of a HTML page with a bit of PHP that generates a random number. It then gets into some of the basic language syntax and statements and how they're used in the PHP code.

tagged: first code tutorial introduction language book excerpt

Link: https://www.sitepoint.com/first-php-code/