PHP Syntax
PHP (Hypertext Preprocessor) is a widely-used open-source scripting language suited for web development. Here's a quick overview of PHP syntax:
1. PHP Tags
PHP code is embedded in HTML using tags:
2. Variables
Variables start with a $
sign:
3. Data Types
Common types: String, Integer, Float, Boolean, Array, Object, NULL.
4. Echo and Print
Used to output text:
5. Conditional Statements
6. Loops
7. Functions
8. Arrays
9. Superglobals
Predefined variables like:
-
$_GET
,$_POST
– form data -
$_SERVER
,$_SESSION
,$_COOKIE