Table of Contents
Introduction
PHP stands for Hypertext Preprocessor. It is a widely used open-source server-side scripting language. It is used for creating dynamic websites and mobile APIs.
The code of PHP is embedded within HTML, and it supports various databases like MySQL, Solid, Oracle, Sybase, etc. PHP is used to manage and manipulate dynamic content, session tracking, databases, and also to build an entire e-commerce site.
PHP is the most famous language because of its ability to impact the outcome with very code significantly. This is the only reason companies invest a good amount of money in hiring proficient PHP developers.
This article will provide the most frequently asked PHP interview questions for freshers and experienced candidates.
Basic Level Interview Questions
- What are variables and constants in PHP?
- What is a session in PHP?
- For what does PEAR stand for?
- Differentiate between $message and $$message.
- Is PHP a case-sensitive language or not?
- What are the different types of variables present in PHP?
- What are the various rules defined for naming a variable?
- Compare the terms “echo” and “print” in PHP.
- What are the advantages of PHP?
- Does PHP support giant content-based web applications?
- Explain the difference between static and dynamic websites.
- Name the scripting engine that powers PHP.
- Highlight the main differences between PHP4 and PHP5.
- Name the popular Content Management Systems in PHP.
- Name some popular frameworks in PHP.
- Name the programming languages which PHP resembles.
- List some of the features of PHP7.
- How will you declare a variable in PHP?
- What are the different ways to define a constant in PHP?
- What are magic constants in PHP?
- Name the different types of data types available in PHP.
- What are the possible ways to write single and multiline comments in PHP?
- Name the different types of loops present in PHP.
- Explain the use of the header() function in PHP.
- Define an isset() function?
- What is a PHP parameterized functions?
- Explain the variable-length argument function in PHP.
- Can we call parent constructors implicitly inside a class constructor?
- How will you pass a variable by reference?
- How will you return a value from a function in PHP?
Intermediate Level Interview Questions
- How do PHP and HTML interact?
- Explain the role of @ in PHP.
- Explain the importance of Parser in PHP.
- Elucidate the different types of Arrays in PHP.
- Explain the main types of errors that occur in PHP.
- What are traits?
- Does Javascript interact with PHP?
- How does the ‘for each’ loop work in PHP?
- Name the most commonly used method for hashing passwords in PHP.
- Compare and contrast include() and require() functions?
- Name the various PHP array functions.
- Compare and contrast indexed and associative arrays.
- How will you find the length of a string in PHP?
- Explain the various PHP string functions.
- How will you download a file in PHP?
- What are the two methods to submit forms in PHP?
- Name the ways to include files in PHP.
- Write down the difference between require and include.
- Explain setcookie() function in PHP?
- How can you retrieve a cookie value?
- Explain the session in PHP.
- How will you register a variable into a session?
- Explain $_SESSION in PHP.
- Explain PHP session_start and session_destroy() function?
- Write the syntax to open a file in PHP.
- How can we read a file in PHP?
- What is the approach to writing a file in PHP?
- How will you delete the file in PHP?
- What is the process of executing a PHP script from the command line?
- How to upload a file in PHP?
- Name the function that is used to send email in PHP.
- What is the method of connecting MySQL database with PHP?
- How will you create a connection in PHP?
- Which method functions are used to create database connections and queries in PHP?
- What is the process of increasing the execution time of a PHP script?
- How will you stop the execution of the PHP scripts?
- Name the encryption functions in PHP.
- Define the term “htaccess” in PHP.
- Explode PHP explode() function?
- Define PHP split() function?
- Write the code to access the IP address of a client in PHP.
- Define the meaning of a Persistent Cookie.
- Explain the use of ‘imagetypes()’?
- What are the various methods of updating Memcached when we make changes in PHP?
- What is the meaning of the ‘===’ array operator?
- Name the two main string operators in PHP.
- Explain the term “Scope of variables”?
- What is the meaning of $GLOBALS mean?
- What are the use of _sleep and _wakeup?
- What is the meaning of accessing a class via::?
Advanced Level Interview Questions
- Is it possible to share a single instance of a Memcache between multiple PHP projects?
- Can we use the COM component in PHP?
- What is the default session time in PHP?
- Is it possible to destroy a cookie?
- Can we extend the execution time of a PHP script?
- Is it possible to pass the variable through the navigation between the pages?
- Explain the difference between characters \034 and \X34.
- Name the three classes of errors that occur in PHP.
- Name the function used to protect the special characters in a query string.
- Explain the difference between ereg_replace() and eregi_replace()?
- Can we submit a form with a dedicated button in PHP?
- Highlight the difference between for and foreach.
- Explain the main key difference between functions strst() and stristr().
- How will you determine whether a variable is a set or not?
- How is it possible a parse a configuration file?
- What is the meaning of the expression- Exception::_toString means?
- Write down the difference between Exceptio::getMessage and Exception::getLine.
- What is the purpose of using the goto statement?
- How will you determine whether a PHP variable is an instantiated object of a certain class?
- What is the difference between $a != $b and $a !== $b?
0 Comments