PHP Web Developer

30+ PHP Web Developer Interview Questions and Answers

Updated 15 Feb 2023
search-icon

Q1. What is the difference between mysqli_fetch_assoc() and mysqli_fetch_array() ?

Ans.

mysqli_fetch_assoc() returns an associative array while mysqli_fetch_array() returns both numeric and associative arrays.

  • mysqli_fetch_assoc() fetches a row from a result set as an associative array.

  • mysqli_fetch_array() fetches a row from a result set as both an associative and numeric array.

  • mysqli_fetch_assoc() is faster than mysqli_fetch_array() when fetching only associative arrays.

  • mysqli_fetch_array() has an optional parameter to specify the type of array to return.

Q2. What is the name of scripting engine in php ?

Ans.

The scripting engine in PHP is called the Zend Engine.

  • The Zend Engine is the core of PHP and is responsible for parsing and executing PHP scripts.

  • It was developed by Zend Technologies and is written in C.

  • The Zend Engine provides features like memory management, garbage collection, and opcode caching.

  • It also includes a just-in-time (JIT) compiler called OPcache for performance optimization.

  • The latest version of the Zend Engine is Zend Engine 3, which was introduced in PHP 7.

PHP Web Developer Interview Questions and Answers for Freshers

illustration image

Q3. what are the ways to include file in php ?

Ans.

There are multiple ways to include files in PHP, such as include, require, include_once, and require_once.

  • include: includes and evaluates a specified file

  • require: includes and evaluates a specified file, but generates a fatal error if the file is not found

  • include_once: includes and evaluates a specified file only once

  • require_once: includes and evaluates a specified file only once, but generates a fatal error if the file is not found

Q4. What is different between private protect in php ?

Ans.

In PHP, private and protected are both access modifiers used to restrict access to class members.

  • private and protected are both used to encapsulate class members and prevent direct access from outside the class

  • private restricts access to only within the class where it is defined

  • protected allows access within the class and its subclasses

  • private members cannot be accessed or modified directly from outside the class

  • protected members can be accessed or modified within the class a...read more

Are these interview questions helpful?

Q5. Do you have a good Internet connection and a higher configuration laptop.

Ans.

Yes, I have a reliable Internet connection and a high-end laptop.

  • I have a stable Internet connection with high-speed bandwidth.

  • My laptop has a higher configuration with ample RAM and processing power.

  • I have tested my Internet connection and laptop performance for smooth web development.

  • I am equipped with necessary tools and software for efficient development.

Q6. How can we call parent class constructor in derived class?

Ans.

To call parent class constructor in derived class, use parent::__construct() method.

  • Use parent::__construct() method in derived class constructor.

  • Pass the required parameters to parent::__construct() method.

  • This will call the parent class constructor and initialize the parent class properties.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Which version of html is getting at thid time and why?

Ans.

The latest version of HTML is HTML5, which is widely adopted for its improved functionality and features.

  • HTML5 is the current version of HTML being used

  • It offers new features like <video>, <audio>, <canvas>, and <svg> elements

  • HTML5 provides better support for multimedia and interactive content

Q8. Function by which, we can convert string to array ?

Ans.

The function to convert string to array is explode().

  • The function takes two parameters: delimiter and string.

  • The delimiter specifies where to break the string into array elements.

  • The function returns an array of strings.

  • Example: $str = 'apple,banana,orange'; $arr = explode(',', $str);

  • This will result in an array with three elements: 'apple', 'banana', and 'orange'.

PHP Web Developer Jobs

PHP Web Developer 4-6 years
Logical Wings
4.9
Ahmedabad
Php Web Developer 2-4 years
KudoMetrics Technologies private limited
3.6
₹ 3 L/yr - ₹ 4 L/yr
Attur
PHP Web Developer 0-4 years
Wisdom InfoSoft
4.0
Nagaur

Q9. Use in html and css includes function use and include_once function difference

Ans.

The include function is used to include and evaluate a specific file during runtime in PHP. include_once function ensures that the file is included only once.

  • include function is used to include and evaluate a specific file in PHP

  • include_once function ensures that the file is included only once

  • Both functions are used to include external files in PHP scripts

Q10. What is default execution time in php ?

Ans.

The default execution time in PHP is 30 seconds.

  • The default execution time can be changed using the 'max_execution_time' directive in the php.ini file.

  • If the execution time exceeds the default limit, a fatal error will occur.

  • Long-running scripts or tasks may require increasing the execution time limit.

Q11. What is Taxonomy, diffrence between category and tags?

Ans.

Taxonomy is the science of classification. Categories are broad groups while tags are specific labels.

  • Taxonomy is the process of organizing and classifying data into groups or categories.

  • Categories are broad groups that items can be classified into, while tags are specific labels that can be assigned to items.

  • For example, a blog post about a recipe might be categorized as 'food' and tagged with 'dessert' and 'chocolate'.

  • Categories are hierarchical, meaning they can have subca...read more

Q12. What is php and what do you know about php ?

Ans.

PHP is a server-side scripting language used for web development.

  • PHP stands for Hypertext Preprocessor

  • It is an open-source language

  • It is used for creating dynamic web pages

  • It can interact with databases like MySQL

  • It can be embedded into HTML code

  • It supports object-oriented programming

  • Popular CMS like WordPress and Drupal are built on PHP

Q13. What is different between front end and back end?

Ans.

Front end is the user-facing part of a website, while back end is the behind-the-scenes part that handles data and functionality.

  • Front end is responsible for the design, layout, and user experience of a website.

  • Back end handles the server-side programming, database management, and server configuration.

  • Front end technologies include HTML, CSS, and JavaScript, while back end technologies include PHP, Python, and Ruby on Rails.

Q14. What is Pear in PHP ?

Ans.

Pear is a PHP extension and application repository that provides reusable components for web development.

  • Pear is a framework for developing and distributing PHP components

  • It provides a structured library of code that can be easily integrated into PHP applications

  • Pear packages can be installed using the 'pear' command-line tool

  • It offers a wide range of functionalities such as database access, XML parsing, email handling, etc.

Q15. What is session? Wht is the uses of session?

Ans.

Session is a way to store information (variables) on the server to be used across multiple pages.

  • Session is used to maintain user-specific data across multiple pages.

  • It is created when a user logs in and destroyed when the user logs out.

  • Session data can be accessed and manipulated using the $_SESSION superglobal variable.

  • Examples of session data include user ID, username, and shopping cart items.

Q16. What are hooks, types of hooks ?

Ans.

Hooks are functions that allow developers to modify the behavior of a program without modifying the code.

  • Hooks are used in WordPress to modify the behavior of a plugin or theme.

  • There are two types of hooks: action hooks and filter hooks.

  • Action hooks allow developers to execute code at specific points in the program's execution.

  • Filter hooks allow developers to modify data before it is displayed or processed.

  • Examples of hooks include 'wp_head' and 'the_content'.

Q17. what is php version ?

Ans.

PHP version is a scripting language used for web development. The latest stable version is PHP 8.0.

  • PHP is a server-side scripting language used for creating dynamic web pages.

  • The latest stable version of PHP is PHP 8.0, released on November 26, 2020.

  • PHP versions prior to PHP 7.0 are no longer supported and may have security vulnerabilities.

  • PHP can be embedded within HTML code using special tags like .

  • PHP supports a wide range of databases, including MySQL, PostgreSQL, and SQL...read more

Q18. What are strengths and weekness??

Ans.

Strengths: Strong problem-solving skills, attention to detail. Weaknesses: Public speaking, time management.

  • Strengths: Proficient in PHP, MySQL, and JavaScript. Experience with MVC frameworks. Strong communication and collaboration skills.

  • Weaknesses: Struggle with public speaking and presenting. Can sometimes struggle with time management and prioritizing tasks.

  • Overall, I am constantly working to improve my weaknesses while leveraging my strengths to deliver high-quality work...read more

Q19. MySQL SQL how to fetch Last record

Ans.

To fetch the last record in MySQL SQL, use the ORDER BY and LIMIT clauses.

  • Use the ORDER BY clause to sort the records in descending order based on the primary key or any other column.

  • Use the LIMIT clause to limit the result set to one record.

  • Example: SELECT * FROM table_name ORDER BY primary_key DESC LIMIT 1;

Q20. What is types of inheritance in php?

Ans.

There are three types of inheritance in PHP: single, multiple, and multilevel.

  • Single inheritance involves a child class inheriting from a single parent class.

  • Multiple inheritance involves a child class inheriting from multiple parent classes.

  • Multilevel inheritance involves a child class inheriting from a parent class, which in turn inherits from another parent class.

  • PHP only supports single inheritance natively, but multiple inheritance can be achieved using interfaces.

  • Exampl...read more

Q21. What is the use of seudo class in css

Ans.

Pseudo classes are used to define a special state of an element.

  • Pseudo classes are preceded by a colon (:)

  • They are used to style elements based on their state or position

  • Examples include :hover, :active, :first-child, :nth-child

Q22. What id default index in mysql ?

Ans.

The default index in MySQL is the primary key index.

  • The default index is created on the primary key column(s)

  • It ensures uniqueness and fast retrieval of data

  • If no primary key is defined, MySQL creates a hidden primary key index

Q23. what is injection in sql ?

Ans.

Injection in SQL is a technique used by hackers to insert malicious code into a database through user input.

  • Injection attacks occur when user input is not properly sanitized or validated

  • Attackers can use injection to steal data, modify data, or even delete data

  • Preventing injection attacks involves using prepared statements and input validation

Q24. what is triiger in mysql ?

Ans.

A trigger in MySQL is a set of SQL statements that automatically execute in response to certain events.

  • Triggers can be used to enforce business rules or perform complex calculations.

  • They can be set to execute before or after an INSERT, UPDATE, or DELETE statement.

  • Triggers can also be used to audit changes to a database or replicate data to other tables.

  • Syntax: CREATE TRIGGER trigger_name trigger_time trigger_event ON table_name FOR EACH ROW trigger_body;

Q25. How to update data in table

Ans.

To update data in a table, use the UPDATE statement in SQL.

  • Use the UPDATE statement followed by the table name

  • Set the column name and new value using SET

  • Use WHERE to specify which rows to update

Q26. Something tell about 'meta' tag in html.

Ans.

The 'meta' tag in HTML is used to provide metadata about the HTML document.

  • Meta tags are placed in the head section of an HTML document.

  • They provide information such as character set, viewport settings, keywords, and descriptions.

  • Example: <meta charset='UTF-8'>

Q27. Web design use in php

Ans.

Web design is an important aspect of PHP development as it determines the look and feel of the website.

  • PHP can be used to create dynamic web pages with custom designs

  • CSS can be used to style the HTML elements generated by PHP

  • Frameworks like Laravel and CodeIgniter provide pre-built templates for web design

  • Responsive design can be implemented using media queries in CSS

Q28. Why do we use wp_head()?

Ans.

wp_head() is used to add scripts, styles, and meta tags to the head section of a WordPress theme.

  • wp_head() is a WordPress function that is called in the header.php file of a theme.

  • It allows developers to add custom scripts, styles, and meta tags to the head section of a WordPress site.

  • This function is important for SEO optimization and for adding custom functionality to a theme.

  • Examples of what can be added using wp_head() include Google Analytics tracking code, custom CSS st...read more

Q29. what is getter and setter

Ans.

Getters and setters are methods used to access and modify the values of private properties in a class.

  • Getters are methods that retrieve the value of a private property.

  • Setters are methods that set the value of a private property.

  • Getters and setters are used to control access to private properties.

  • Getters and setters can have additional logic to validate or manipulate the property value.

  • Example: public function getName() { return $this->name; }

  • Example: public function setName(...read more

Q30. Wht is php? Need of php?

Ans.

PHP is a server-side scripting language used for web development.

  • PHP stands for Hypertext Preprocessor.

  • It is an open-source language.

  • PHP is used to create dynamic web pages.

  • It can interact with databases like MySQL.

  • PHP is easy to learn and widely used in web development.

  • Popular CMS like WordPress, Drupal, and Joomla are built on PHP.

Q31. CRUD OPERATION USAGES

Ans.

CRUD operations are used for creating, reading, updating, and deleting data in a database.

  • Create - inserting new data into the database

  • Read - retrieving data from the database

  • Update - modifying existing data in the database

  • Delete - removing data from the database

  • CRUD operations are essential for web applications that require data storage and management

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions for PHP Web Developer Related Skills

Interview experiences of popular companies

3.8
 • 8.1k Interviews
3.6
 • 7.5k Interviews
3.5
 • 3.8k Interviews
4.0
 • 2.3k Interviews
3.9
 • 261 Interviews
3.9
 • 140 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

PHP Web Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter