সব টুল
বিনামূল্যে

একটি অনুসন্ধানযোগ্য, প্রিন্টযোগ্য PHP 8.3+ রেফারেন্স — সিনট্যাক্স, স্ট্রিং, অ্যারে, ফাংশন, ক্লাস, enum, অ্যাট্রিবিউট এবং আধুনিক ফিচার। বিনামূল্যে।

Basics & types

10
declare(strict_types=1);
Enforce strict scalar type checks
$x = 1;
Variables start with a dollar sign
const MAX = 100;
Compile-time constant
gettype($x)
Get the type of a value
(int) $x
Cast to an integer
is_int($x)
Type-check helper (is_string, ...)
int|string $x
Union type declaration
?string $x
Nullable type (string or null)
$a ?? 'default'
Null coalescing operator
$a ??= 'default'
Assign only if null

Strings

11
"Hello $name"
Double quotes interpolate variables
'literal $x'
Single quotes are literal
$a . $b
Concatenate strings
strlen($s)
Byte length of a string
str_contains($s, 'a')
Check for a substring
str_starts_with($s, 'a')
Check the prefix
substr($s, 0, 3)
Extract part of a string
str_replace('a', 'b', $s)
Replace all occurrences
explode(',', $s)
Split into an array
sprintf('%05.2f', $n)
Formatted string output
trim($s)
Strip surrounding whitespace

Arrays

11
$a = [1, 2, 3];
Indexed array literal
$a = ['k' => 'v'];
Associative array
array_map(fn($x) => $x * 2, $a)
Transform each element
array_filter($a, fn($x) => $x > 0)
Keep matching elements
array_reduce($a, $fn, 0)
Reduce to a single value
in_array($v, $a, true)
Strict value check
array_keys($a)
Get all keys
array_merge($a, $b)
Merge arrays
[...$a, ...$b]
Spread/merge arrays
count($a)
Number of elements
[$x, $y] = $a;
Array destructuring

Functions

9
function f(int $a): int {}
Typed parameters and return
function f(int $a = 1) {}
Default parameter value
function f(int ...$nums) {}
Variadic parameters
f(...$args)
Spread arguments
f(name: 'Sam', age: 30)
Named arguments
$fn = fn($x) => $x + 1;
Arrow function (auto-captures scope)
function () use ($x) {}
Closure capturing a variable
$fn = strlen(...);
First-class callable syntax
function f(): never {}
Never returns (throws or exits)

Control flow

9
if ($a) {} elseif ($b) {} else {}
Conditional branches
$a ? $b : $c
Ternary expression
$a ?: $b
Short ternary (falsy fallback)
match ($x) { 1, 2 => 'a', default => 'b' }
Strict, expression-based match
switch ($x) { case 1: break; }
Loose multi-way branch
foreach ($a as $k => $v) {}
Iterate keys and values
for ($i = 0; $i < 10; $i++) {}
Counted loop
while ($cond) {}
Loop while a condition holds
break / continue
Exit or skip a loop iteration

Classes & OOP

10
class A extends B implements C {}
Inheritance and interfaces
public function __construct(private int $id) {}
Constructor property promotion
public readonly string $name;
Immutable after initialization
public function f(): static {}
Return the late-bound type
static::create()
Late static binding
$obj?->method()
Null-safe method call
abstract class A {}
Cannot be instantiated directly
trait T {} use T;
Reusable horizontal code
$obj instanceof A
Type check at runtime
A::class
Fully-qualified class name string

Enums

9
enum Status { case Active; case Draft; }
Pure enumeration
enum Status: string { case A = 'a'; }
Backed enum (string/int)
Status::Active
Reference an enum case
Status::from('a')
Build from a backing value
Status::tryFrom('x')
Returns null if invalid
Status::cases()
Array of all cases
$status->value
Backing value of a case
$status->name
Name of the case
enum E { public function label() {} }
Enums can have methods

Error handling

9
try {} catch (Throwable $e) {}
Catch errors and exceptions
catch (TypeError | ValueError $e)
Catch multiple types
catch (Exception)
Non-capturing catch (no variable)
finally {}
Always runs after try/catch
throw new RuntimeException('x')
Throw an exception
throw $e;
Re-throw the caught exception
$x = $v ?? throw new Error();
Throw as an expression
$e->getMessage()
Read the error message
$e->getPrevious()
Get the chained exception

Attributes & modern

9
#[Attribute] class Route {}
Declare a custom attribute
#[Route('/home')]
Apply an attribute to a target
new ReflectionClass($x)
Inspect a class via reflection
$ref->getAttributes()
Read declared attributes
json_encode($data)
Serialize to JSON
json_decode($s, true)
Decode JSON to an array
array_is_list($a)
True if keys are 0..n in order
str_word_count($s)
Count words in a string
$obj::class
Class name from an instance

“:q”-এর সাথে কোনো এন্ট্রি মেলে না।


PHP চিট শিট সম্পর্কে

এই PHP চিট শিট আধুনিক PHP-কে একটি সার্চযোগ্য পেজে সংক্ষিপ্ত করে: বেসিক ও টাইপ, স্ট্রিং, অ্যারে, ফাংশন, কন্ট্রোল ফ্লো, ক্লাস ও OOP, enum, ত্রুটি হ্যান্ডলিং, এবং attribute ও অন্যান্য আধুনিক ফিচার। প্রতিটি সারি একটি রান-করা-যায় স্নিপেট, সাথে সহজ ইংরেজি বর্ণনা।

এটি PHP 8.3+ লক্ষ্য করে, তাই আপনি বর্তমান PHP-কে সংজ্ঞায়িত করা ফিচারগুলো পাবেন — enum, readonly প্রপার্টি, constructor property promotion, named argument, match এক্সপ্রেশন, অ্যারো ফাংশন, nullsafe কল এবং attribute — সাথে আপনি প্রতিনিয়ত ব্যবহার করা প্রাত্যহিক স্ট্রিং ও অ্যারে ফাংশন।

পেজটি বিনামূল্যে এবং সম্পূর্ণ ক্লায়েন্ট-সাইড: আপনি টাইপ করার সাথে সাথে সার্চ সারিগুলো ফিল্টার করে, স্টিকি সেকশন মেনু আপনাকে শিটের চারপাশে নিয়ে যায়, এক ক্লিকে যেকোনো স্নিপেট কপি হয়, এবং একটি প্রিন্ট বাটন এটিকে একটি কাগজের PHP রেফারেন্সে পরিণত করে।

PHP চিট শিট কীভাবে ব্যবহার করবেন

  1. সূচিপত্র দেখুন — Basics & types থেকে Enums, Error handling এবং Attributes & modern পর্যন্ত।
  2. পুরো শিটটি তাৎক্ষণিক ফিল্টার করতে সার্চ বক্সে একটি ফাংশন নাম বা কীওয়ার্ড টাইপ করুন।
  3. স্টিকি সাইডবার নেভিগেশন দিয়ে Classes & OOP-এর মতো একটি সেকশনে যান।
  4. PHP কোডটি আপনার ক্লিপবোর্ডে কপি করতে যেকোনো স্নিপেট বা এর কপি আইকনে ক্লিক করুন।
  5. পুরো রেফারেন্স কাগজে চাইলে Print চাপুন।

সচরাচর জিজ্ঞাসিত প্রশ্ন

এটি PHP 8.3 এবং তার পরবর্তীর জন্য লেখা। enum, attribute ও আধুনিক ফিচারের সেকশনগুলো ক্লাসিক সিনট্যাক্সের পাশাপাশি readonly প্রপার্টি, constructor promotion, match এক্সপ্রেশন, named argument ও nullsafe কল কভার করে।

নয়টি সেকশন: বেসিক ও টাইপ, স্ট্রিং, অ্যারে, ফাংশন, কন্ট্রোল ফ্লো, ক্লাস ও OOP, enum, ত্রুটি হ্যান্ডলিং, এবং attribute প্লাস আধুনিক ফিচার — বাস্তব প্রজেক্টে আপনি প্রতিদিন ব্যবহার করেন এমন PHP-এর অংশগুলো।

উপরের সার্চ বক্স ব্যবহার করুন। এটি সব সেকশন জুড়ে প্রতিটি সারি লাইভ ফিল্টার করে এবং একটি ম্যাচ কাউন্ট দেখায়, তাই array_map-এর মতো কিছু টাইপ করলে শিটটি প্রাসঙ্গিক স্নিপেটে তাৎক্ষণিক সংকুচিত হয়।

হ্যাঁ। কোডটি বা হোভার কপি আইকনে ক্লিক করুন এবং স্নিপেটটি আপনার ক্লিপবোর্ডে চলে যায়, একটি সংক্ষিপ্ত "Copied!" ফ্ল্যাশ দ্বারা নিশ্চিত।

হ্যাঁ, সম্পূর্ণ বিনামূল্যে। এটি আপনার ব্রাউজারে রেন্ডার হয়, কোনো অ্যাকাউন্ট প্রয়োজন নেই এবং আপনি যতবার খুশি প্রিন্ট করতে পারেন।

শেয়ার করুন

জনপ্রিয় অনুসন্ধান
php cheat sheet php syntax reference php array functions php string functions php enums example php 8 attributes php oop cheat sheet php try catch example
সাহায্য দরকার?
এই টুলে কোনো সমস্যা পেয়েছেন? আমাদের দলকে জানান।
সমস্যা রিপোর্ট করুন

আপনার নিজের ওয়েবসাইটে এই বিনামূল্যের টুলটি যোগ করুন — নিচের কোডটি কপি করে পেস্ট করুন।