Interview PHP PHP Basics

PHP Basics Questions

4 visible of 5 total
Free Access
Q1
Free (All Users)

What is PHP ?

English Version : 

PHP stands for Hypertext Preprocessor.

PHP is a server-side scripting language used to create dynamic web pages. PHP runs on the server, not in the browser.

What does Server-Side mean?

PHP does not run in the browser. It runs on the server 

Complete Flow: 

  1. The user enters a URL in the browser example.com/index.php
  2. The request goes to the web server.
  3. The server detects a .php file and sends it to the PHP interpreter
  4. PHP executes the code: 
    • Fetches data from the database

    • Runs business logic

    • Generates HTML output
  5. The server sends only the final HTML to the browser.

Note: The PHP code is never visible in the browser

Hindi version : 

PHP (Full form of PHP Hypertext Preprocessor) एक Server-side scripting language है |जो Dynamic web pages बनाने के लिए use होती है।

Dynamic का मतलब: हर user को अलग-अलग data दिख सकता है (Database से data लेकर  user को website में दिखाई देता हैं)

Server-side का मतलब:

PHP browser में नहीं चलती, ये server पर चलती है|

Step by Step पूरा flow समझो:

  1. User browser में URL डालता है example.com/index.php

  2. Request server पर जाती है (Apache/Nginx)

  3. Server PHP को execute करता है

  4. PHP कैसे execute होती है : 

    • Database से data लाती है 

    • Logic run करती है

    • HTML बनाती है

Browser को सिर्फ final HTML output मिलता है

Note : PHP code कभी browser में नहीं दिखता

Q2
Free (All Users)

What is PHP and what does it stand for?

PHP stands for Hypertext Preprocessor (originally Personal Home Page). It is a widely-used open-source server-side scripting language that is especially suited for web development.

Key characteristics:

  • Server-side execution
  • Embedded in HTML
  • Cross-platform compatibility
  • Supports multiple databases
  • Large community and ecosystem
Easy Most Asked
Q3
Free (All Users)

What are the differences between echo and print in PHP?

Both echo and print are used to output data in PHP, but they have subtle differences:

  • echo: Can take multiple parameters (comma-separated), does not return a value, slightly faster
  • print: Takes only one argument, always returns 1, can be used in expressions
echo "Hello", " World"; // Works
print "Hello World";     // Works
$result = print "test";  // $result is 1
Easy
Q4
Free (All Users)

Explain the difference between == and === in PHP.

These are comparison operators with different strictness levels:

  • == (Loose comparison): Compares values after type juggling. "5" == 5 is true
  • === (Strict comparison): Compares both value AND type. "5" === 5 is false

Best practice: Always use === to avoid type coercion bugs.

var_dump(0 == "foo");   // true (PHP 7) – Dangerous!
var_dump(0 === "foo");  // false – Safe!