PHP (hypertext preprocessor) is a widely-used open source general-purpose scripting language suitable for web development and can be embedded in HTML.
That’s nice, but what exactly does that imply? Consider the following scenario:
The first example is a simple one.
!DOCTYPE html> html> html> html> html> html> html> html> html> html> html> html> html> html> html
/head> /body> /title> /head> /body> /title> /head> /body> /head
PHP echo “Hello, I’m a PHP script!”; PHP echo “Hello, I’m a PHP script!”; PHP echo “Hello, I’m a PHP script!”
PHP pages contain HTML with embedded code that performs “something” (in this example, print “Hi, I’m a PHP script!”) instead of a long list of commands to produce HTML (like in C or Perl). The PHP code is encased between specific start and end processing instructions?PHP and?> that enable you to switch between “PHP mode” and “normal mode.”
The nicest thing about PHP is that it is very easy to learn for a beginner, but it has a lot of complex capabilities for a skilled programmer. Don’t be frightened to browse through PHP’s extensive feature list. You can hop right in and begin developing simple scripts in hours.
Although PHP was designed with server-side scripting in mind, it is capable of much more. Continue reading to learn more about what PHP can achieve, or skip straight to the beginning course if you’re solely interested in web development.