PHP Interview Master
The ultimate collection of 200+ meticulously curated PHP questions to help you ace your backend developer interview.
What is PHP?
BeginnerPHP (Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded i...
Comprehensive Answer
Who is the creator of PHP?
BeginnerRasmus Lerdorf created PHP in 1994.
Comprehensive Answer
What does PHP stand for originally?
BeginnerOriginally, PHP stood for 'Personal Home Page', but it now stands for the recursive acronym 'PHP: Hypertext Preprocessor'.
Comprehensive Answer
How do you execute a PHP script from the command line?
BeginnerYou can use the PHP CLI (Command Line Interface). Simply open a terminal and type: `php script.php`.
Comprehensive Answer
PHP Example
php script.phpWhat are the PHP tags?
BeginnerPHP code is usually enclosed in `<?php ... ?>`. Short open tags `<? ... ?>` are also available but generally not recommended for portability.
Comprehensive Answer
How do you comment in PHP?
BeginnerPHP supports single-line comments using `//` or `#`, and multi-line comments using `/* ... */`.
Comprehensive Answer
PHP Example
// Single line
# Also single line
/*
Multi-line
*/What are variables in PHP?
BeginnerVariables are used to store data, like text strings, numbers, or arrays. In PHP, all variables must be prefixed with a dollar sign (`$`).
Comprehensive Answer
Are variable names case-sensitive in PHP?
BeginnerYes, variable names in PHP are case-sensitive. `$Name` and `$name` are two different variables. (Note: Keywords, classes, and function names are NOT case-sensit...
Comprehensive Answer
What are the common data types in PHP?
BeginnerCommon data types include Integer, Float (Double), String, Boolean, Array, Object, NULL, and Resource.
Comprehensive Answer
How do you concatenate strings in PHP?
BeginnerYou use the dot (`.`) operator to concatenate strings.
Comprehensive Answer
PHP Example
$str1 = 'Hello';
$str2 = ' World!';
echo $str1 . $str2; // Outputs: Hello World!