Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

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

FunctionPurpose
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