The PHP syntax is very similar to Perl and C.
Strings can be placed in single quotes or double quotes; this differs from Java, where single quotes are used only to enclose one single character rather than a string.
- single quoted strings don't recognize most special character codes like \n  and don't expand variables, however they do recognize \' and \\ 
The string concatenation operator is the period (or full stop). This is a major difference from many other programming languages, which use a plus sign or ampersand.
$first = "car"; $second = "nation"; $product= $first . $second; // Equivalent to: $product= "carnation"
PHP recognizes variable names within strings, which are enclosed in double quotes. Since all variables begin with a dollar sign, it is easy to embed one string inside another. This is the preferred way to create HTML output.
$first = "John"; $middle = "Quincy" $last = "Adams"; // Show full name, in bold format echo "<B>$first $middle $last</B>";
This outputs "<B>John Quincy Adams</B>" to the HTML page.
PHP is compatible with multiple databases, MySQL being the most popular. They go together so well that it's tempting to think of PHP as primarily middleware to link MySQL on the back end to HTML on the front end.
Overall, PHP is compatible with:
- MS-SQL 2000
and many others.
PHP and MySQL
PHP and MySQL are both free software, and they work together well for making database-backed websites.
Methods for PHP to access MySQL databases include mysqli and PDOs.
- How to Do Everything with PHP & MySQL, Vikram Vaswani (McGraw-Hill, 2005)
- PHP.net - Official PHP Website.