PHP Cheat Sheet
Basic Syntax
<?php echo "Hello"; ?>
Variables & Data Types
$str = "Hello"; // String
$int = 42; // Integer
$float = 3.14; // Float
$bool = true; // Boolean
$arr = [1, 2, 3]; // Array
Common Functions
| Function | Purpose |
|---|---|
strlen($s) | String length |
count($a) | Array length |
isset($v) | Check if set |
empty($v) | Check if empty |
die() | Stop execution |
include() | Include file |
Superglobals
$_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, $_FILES