All questions
Showing of 78What is PHP and what does it stand for?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
PHP stands for "PHP: Hypertext Preprocessor" (a recursive acronym). It's a server-side scripting language designed for web development that executes on the server and returns HTML to the browser. PHP is open-source, platform-independent, and can be embedded directly into HTML.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are the differences between echo and print in PHP?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Both echo and print are used to output data, but they have key differences:
- Return value:
echohas no return value, whileprintalways returns 1 - Parameters:
echocan take multiple parameters,printcan only take one - Speed:
echois marginally faster since it doesn't return a value - Usage:
echocan be used with or without parentheses,printcan also be used both ways
echo "Hello", " World"; // Works
print "Hello World"; // Works
// print "Hello", " World"; // Error - multiple parameters not allowed
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between include, require, include_once, and require_once.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
- include: Includes a file; produces a warning if file not found but continues execution
- require: Includes a file; produces a fatal error if file not found and stops execution
- include_once: Same as include but ensures the file is included only once
- require_once: Same as require but ensures the file is included only once
The "_once" variants prevent redeclaration errors when the same file might be included multiple times.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are PHP tags and what are the different types?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
PHP tags are used to embed PHP code in HTML. The types are:
- Standard tags:
<?php ... ?>(recommended and always available) - Short echo tags:
<?= ... ?>(for outputting, always enabled in PHP 5.4+) - Short tags:
<? ... ?>(not recommended, requires short_open_tag enabled) - ASP tags:
<% ... %>(removed in PHP 7.0)
Standard tags are recommended for maximum compatibility and clarity.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are the main data types in PHP?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
PHP supports several data types grouped into three categories:
- Scalar types: boolean, integer, float/double, string
- Compound types: array, object, callable, iterable
- Special types: resource, NULL
PHP is dynamically typed, meaning variables don't need explicit type declaration and can change types during execution.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between == and === operators.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
- == (Equal): Checks if values are equal after type juggling (type coercion)
- === (Identical): Checks if values are equal AND of the same type (strict comparison)
$a = "5"; // string
$b = 5; // integer
var_dump($a == $b); // true (values equal after conversion)
var_dump($a === $b); // false (different types)
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is type juggling in PHP?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Type juggling is PHP's automatic conversion of data types based on context. While convenient, it can cause unexpected results.
$str = "10";
$num = 5;
echo $str + $num; // 15 (string converted to integer)
Use strict comparison (===) and type declarations to avoid issues.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are superglobal variables in PHP?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Superglobals are built-in variables that are always accessible from any scope without using the global keyword. The main superglobals are:
- $_GET: Contains GET request data
- $_POST: Contains POST request data
- $_SESSION: Contains session variables
- $_COOKIE: Contains cookie values
- $_SERVER: Contains server and environment information
- $_FILES: Contains information about uploaded files
- $_ENV: Contains environment variables
- $_REQUEST: Contains combined GET, POST, and COOKIE data
- $GLOBALS: Contains all global variables
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you declare constants in PHP and what's the difference between define() and const?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Constants can be declared using define() function or const keyword:
- define(): Can be used anywhere, supports dynamic names and conditional declaration
- const: Must be declared at top-level scope, faster at compile time, supports class constants
define('MAX_SIZE', 100);
const MIN_SIZE = 10;
// define() can be conditional
if ($condition) {
define('DYNAMIC', 'value');
}
// const cannot be used conditionally
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the null coalescing operator and how does it work?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The null coalescing operator ?? (introduced in PHP 7.0) returns the first operand if it exists and is not null, otherwise returns the second operand. It's useful for providing default values.
$username = $_GET['user'] ?? 'guest';
// Equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'guest';
PHP 7.4 introduced the null coalescing assignment operator ??= for even more concise code.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the spaceship operator in PHP.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The spaceship operator <=> (introduced in PHP 7.0) is a three-way comparison operator that returns:
- -1 if left operand is less than right
- 0 if operands are equal
- 1 if left operand is greater than right
echo 1 <=> 2; // -1
echo 2 <=> 2; // 0
echo 3 <=> 2; // 1
It's particularly useful for sorting callbacks and comparing multiple values.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between break and continue statements?
What are variable functions in PHP?
Explain the difference between pass by value and pass by reference.
What are anonymous functions (closures) in PHP?
What is the difference between func_get_args() and using parameters?
Explain variable scope in PHP?
What is method chaining and how do you implement it?
Explain the difference between array_merge() and array_combine().
What are the different error levels in PHP?
What are the main principles of OOP in PHP?
Explain the difference between abstract classes and interfaces.
What are PHP traits and when would you use them?
What are magic methods in PHP?
Explain late static binding in PHP.
What are PHP namespaces and why are they important?
What's the difference between indexed and associative arrays?
What are the differences between array_map(), array_filter(), and array_reduce()?
How do you check if a key exists in an array?
Explain the difference between errors and exceptions in PHP.
How do you create and handle custom exceptions?
What is the finally block and when is it executed?
What is PDO and what are its advantages over MySQLi?
What are prepared statements and why are they important?
Explain database transactions in PHP.
What is the N+1 query problem and how do you solve it?
What's the difference between sessions and cookies?
How do you implement secure session management?
What is session fixation and how do you prevent it?
What is SQL injection and how do you prevent it?
Explain Cross-Site Scripting (XSS) and prevention methods.
What is CSRF and how do you protect against it?
How do you properly hash passwords in PHP?
What are the security implications of file uploads?
What are the differences between REST and SOAP?
How do you handle API authentication in PHP?
What is CORS and how do you handle it in PHP?
How do you implement rate limiting in PHP APIs?
What are PHP CodeSniffer and PHP CS Fixer?
What is Composer and how does it work?
Explain PSR standards and their importance.
What is the difference between require and autoloading?
How does PHP handle memory management?
What is opcode caching and how does it improve performance?
Explain lazy loading and eager loading in the context of PHP.
What are the best practices for database query optimization in PHP?
How do you implement caching in PHP applications?
What are typed properties in PHP and their benefits?
Explain union types in PHP 8.
What are attributes (annotations) in PHP 8?
What is the match expression and how does it differ from switch?
Explain constructor property promotion in PHP 8.
What are enumerations (enums) in PHP?
Explain the Singleton pattern and its implementation in PHP.
What is dependency injection and why is it important?
Explain the MVC pattern in PHP applications.
What is the Repository pattern?
What are the different types of testing in PHP?
How do you debug PHP applications effectively?
What is PHPUnit and how do you write effective unit tests?
What is code coverage and why is it important?
Explain mocking and stubbing in PHP testing.
What are generators and when should you use them?
Explain the concept of immutability in PHP.
What is reflection in PHP and what are its use cases?
What are SOLID principles and how do they apply to PHP?
How do you handle configuration in PHP applications?
What is the difference between synchronous and asynchronous PHP?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
PHP cheatsheet
- PHP Basics01
- Data Types & Variables02
- Operators03
- Control Structures04
- Functions05
- Arrays06
- Object-Oriented Programming07
- Namespaces & Autoloading08
- Error Handling09
- Database Operations (PDO)10
- Sessions & Cookies11
- Security Best Practices12
- + 12 more inside
- + 18 more inside
67 of 78 PHP answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.