# PHP

Domains:

PHP — Is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

• Recursive acronym for PHP: Hypertext Preprocessor.
• The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer.
• Is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies.
• Can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, macOS, RISC OS, and probably others.
One of the strongest and most significant features in PHP is its support for a wide range of databases.
Has useful text processing features, which includes the Perl compatible regular expressions (PCRE), and many extensions and tools to parse and access XML documents.

### Three main areas where PHP scripts are used

• Server-side scripting.
• Command line scripting.
• Writing desktop applications.

<html>
<title>PHP Test</title>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
1. Create a file named hello.php and put it in your web server's root directory (DOCUMENT_ROOT).
2. Use your browser to access the file with your web server's URL, ending with the /hello.php file reference. When developing locally this URL will be something like http://localhost/hello.php or http://127.0.0.1/hello.php but this depends on the web server's configuration.

### Dealing with Forms

One of the most powerful features of PHP is the way it handles HTML forms.
The basic concept that is important to understand is that any form element will automatically be available to your PHP scripts.

### Escaping from HTML

<p>This is going to be ignored by PHP and displayed by the browser.</p>
<?php echo 'While this is going to be parsed.'; ?>
<p>This will also be ignored by PHP and displayed by the browser.</p>

Everything outside of a pair of opening and closing tags is ignored by the PHP parser which allows PHP files to have mixed content.

This allows PHP to be embedded in HTML documents, for example to create templates.

<?php
echo 'This is a test'; // This is a one-line c++ style comment
/* This is a multi line comment
yet another line of comment */
echo 'This is yet another test';
echo 'One Final Test'; # This is a one-line shell-style comment
?>

PHP supports 'C', 'C++' and Unix shell-style (Perl style) comments.

PHP

## PHP — Structure map

Clickable & Draggable!