20 Interview questions for PHP Developer

php developer

Hello!! In today’s section we’re providing you some frequently asked PHP Interview Questions which will help you to win interview session easily. And if you’re an interviewer, Take the time to read the common interview questions you will most likely be asked.

  1. What is PHP?

PHP is a web language based on scripts that allow developers to dynamically create generated web pages. PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.

  1. What does PEAR stands for?

PEAR means “PHP Extension and Application Repository”. It extends PHP and provides a higher level of programming for web developers.

  1. How do you execute a PHP script from the command line?

Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows:

php script.php

  1. Is multiple inheritance supported in PHP?

PHP supports only single inheritance; it means that a class can be extended from only one single class using the keyword ‘extended’.

  1. How can PHP and HTML interact?

It is possible to generate HTML through PHP scripts, and it is possible to pass pieces of information from HTML to PHP.

  1. What’s the difference between include() and require()?

If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

  1. Differences between GET and POST methods?

We can send 1024 bytes using GET method but POST method can transfer large amount of data and POST is the secure method than GET method.

  1. How to set & retrieve cookies in PHP?

To set: Setcookie(“sample”, “ram”, time()+3600);

To retrieve: echo $_COOKIE[“user”];

  1. What is the difference between Session and Cookie?

The main difference between sessions and cookies is that sessions are stored on the server, and cookies are stored on the user’s computers in the text file format. Cookies can’t hold multiple variables while session can hold multiple variables. We can set expiry for a cookie, the session only remains active as long as the browser is open. Users do not have access to the data you stored in Session, since it is stored in the server. Session is mainly used for login/logout purpose while cookies using for user activity tracking

  1. What types of loops exist in php?

For, while, do while and foreach

  1. How can we connect to a MySQL database from a PHP script?

To be able to connect to a MySQL database, we must use mysqli_connect() function as follows:

<!–?php $database = mysqli_connect(“HOST”, “USER_NAME”, “PASSWORD”); mysqli_select_db($database,”DATABASE_NAME”); ?–>

  1. How can I display text with a PHP script?

Two methods are possible:

<!–?php echo “Method 1”; print “Method 2”; ?–>

  1. What is the static variable in function useful for?

A static variable is defined within a function only the first time, and its value can be modified during function calls as follows:

<!–?php function testFunction() { static $testVariable = 1; echo $testVariable; $testVariable++; } testFunction();        //1 testFunction();        //2 testFunction();        //3 ?–>

  1. What are SQL Injections, how do you prevent them and what are the best practices?

SQL injections are a method to alter a query in a SQL statement send to the database server. That modified query then might leak information like username/password combinations and can help the intruder to further compromise the server.

To prevent SQL injections, one should always check & escape all user input. In PHP, this is easily forgotten due to the easy access to $_GET & $_POST, and is often forgotten by inexperienced developers. But there are also many other ways that users can manipulate variables used in a SQL query through cookies or even uploaded files (filenames). The only real protection is to use prepared statements everywhere consistently.

  1. What’s the difference between unset()and unlink()

unset() sets a variable to “undefined” while unlink() deletes a file we pass to it from the file system.

  1. What are the main error types in PHP and how do they differ?

In PHP there are three main types of errors:

  • Notices– Simple, non-critical errors that are occurred during the script execution. An example of a Notice would be accessing an undefined variable.
  • Warnings– more important errors than Notices, however the scripts continue the execution. An example would be include() a file that does not exist.
  • Fatal– this type of error causes a termination of the script execution when it occurs. An example of a Fatal error would be accessing a property of a non-existent object or require() a non-existent file.
  1. What are Traits?

Traits are a mechanism that allows you to create reusable code in languages like PHP where multiple inheritance is not supported. A Trait cannot be instantiated on its own.

  1. Can the value of a constant change during the script’s execution?

No, the value of a constant cannot be changed once it’s declared during the PHP execution.

  1. Can you extend a Finaldefined class?

No, you cannot extend a Final defined class. A Final class or method declaration prevents child class or method overriding.

  1. What are the __construct()and __destruct() methods in a PHP class?

All objects in PHP have Constructor and Destructor methods built-in. The Constructor method is called immediately after a new instance of the class is being created, and it’s used to initialize class properties. The Destructor method takes no parameters.

5 Advantages of ERP and CRM Integration for Your Business

Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) are two of the most vital tools that are available to businesses today. ERP systems could be called the “back-end”, since they are responsible for all the data that is used in an organization. In the same way, CRM systems could be viewed as the “front-end”, since they are involved directly in enriching the user experience. ERP and CRM systems are becoming more and more common in today’s global marketplace. While it might be easy to write off one system as more valuable than the other, understanding the value of both systems individually as well as integrated can work wonders for your organization.

Most organizations use both ERP and CRM systems, but implement them separately. However, what if one performed ERP and CRM integration? Both of these systems have their distinct benefits, but combining them can be even more beneficial. Here are some key benefits of ERP and CRM integration:

·         A complete view of data

Both ERP and CRM systems depend on the data generated. ERP systems have the key benefit of having centralized data storage; thus redundancy is eliminated to a large extent. CRM does a similar task for the front-end data received from the customers. However, the format of the data received from the customers and the data generated via business processes are quite different. This becomes problematic when the two data sets overlap and are both needed to make decisions.

ERP and CRM integration solves this problem in a single shot. The central data is maintained for both fronts and shared throughout the organization. This gives a 360-degree visibility of every kind of data generated within an organization. In turn, this visibility allows you to make more informed and effective decisions.

·         Enhanced workflow

The detached business processes pose a problem in any business. To solve this, ERP and CRM systems were implemented. However, the task done by these systems separately could be done more efficiently if they were integrated into one.

With ERP and CRM integration, you can achieve automated workflow and streamlined your direct and distribution sales channels without any miscommunications. If your CRM system is integrated correctly, it should be able to support both types of selling that your firm uses every day. This is necessary if your company is going to be able to effectively turn the proposals generated within CRM into actual orders that are tracked through ERP. This results in much higher productivity than what would have been achieved otherwise.

·         Improved Customer Service

Customer contests are a popular way to stay up to date with consumers and keep engagement high. However, tracking and implementing these customer engagement tools can be time consuming and tedious. Luckily, with an integrated system users will be able to link social media activity to your system, stay up to date with customer compliments and complaints, as well as be able to access their billing information/tracking information. With CRM and ERP integration, customers will feel as if their time is valued and employees will be able to confidently deliver the information they need.

·         Better coordination

Lastly, as we mentioned earlier, ERP and CRM integration facilitate complete streamlining of processes. Not only does it fasten the processes, it also enables various departments to coordinate. Users will be able to simultaneously access the contact and account information within both your ERP and CRM systems without having to toggle between screens. Every department can be on the same page as the data is shared among all. Superiors can view all the relevant data in a streamlined format. All of this greatly improves the performance of the employees as well as make it easier than ever to keep track of prospects and clients without losing the critical information that you need to drive sales and seal the deal.

·         Gives you financial growth

In any business, saving money is of vital importance. Integrating ERP and CRM systems can help you achieve that to a large extent. For instance, the implementation of ERP and CRM systems requires training the employees in the same. Separate implementation of these systems would lead to separate training sessions. However, if you chose to integrate ERP and CRM systems into one, it would reduce the training hours by a considerable amount, thus saving you a lot of training cost.

For every system, a team of IT professionals is required for support. Separate implementation of ERP and CRM systems often require a large IT support staff, along with the creation of an interface between the two systems. However, with ERP and CRM integration, there is only one system to manage, which reduces the cost of IT support.

Getting a rapid turn on investment should be on the minds of every business in the market, thankfully with an integrated CRM and ERP system,determining of ROI is as simple as ever. The sooner the integration the better and can ensure a much simpler transition. Get the most out of your critical information so you can capitalize on every opportunity. Not to mention the fact that the technology available now to help make this change is quite inexpensive, thereby lessening expenses and enabling you to take advantage of the benefits sooner, rather than later.


The integration of CRM and ERP systems helps get rid of many flaws like data redundancy, delays and inconsistent formats. At the same time, it is much easier to manage one integrated system than two separate ones. So, overall, ERP and CRP integration can prove to be a huge boon for your business.

Even though these systems have an array of advantages, there is always scope for more.  For expert advice contact Connivia Tech Solutions @ 9768161641.