PHP is the most widely used open-source programming language that is created specifically for developing dynamic websites and mobile APIs. PHP is the most demanded programming skills in various companies at present. Also, PHP developers have a great demand at present. Most of the companies are looking for Developers with PHP skills on their resume. If you are planning to begin a career in PHP then, you can start your career now in PHP as it is the right time to begin.

To qualify oneself to the position of PHP Developer in an Interview, one should be well-prepared for the questions that are asked to them in an Interview. Given below are the 101 PHP and MySQL Interview Questions and answers for freshers and Experienced. As MySQL is the database for PHP we have enlisted a few questions that are related to MySQL.

  1. Explain Echo?
The echo can take more than one string for output and return 1.
  1. What is the name of the Script Engine in PHP?
Zend Engine 2
  1. What is the trim() function?
It removes the predefined characters and white space from two sides of the string.
  1. What ways can we retrieve data? On the result sets of MySql using PHP?
There are four ways to retrieve and they are
  • mysql_fetch_row
  • mysql_fetch_assoc
  • mysql_fetch_array
  • mysql_fetch_object
  1. What is the limitation of print?
The Print can take only one argument as the parameter.
  1. What is an in_array() function?
This function scans the complete array to find a specific value.
  1. What are the uses of count() function in PHP?
This function is used in counting all the elements in the array.
  1. How can we include the file to the PHP page?
We could include the file to the PHP page using a require() or include() function with the file path as their parameter.
  1. How do you create a Database using MySQL and PHP?
We can create the MySQL Database by using mysql_create_db (“Database Name”)
  1. List three features of MySQL?
MySQL is easy and reliable for use. MySQL supports various programming languages like PHP, Java, Perl, and C++. MySQL supports standard SQL that means (Structured Query Language). These types of PHP and MySQL Interview Questions for fresher in an Interview.
  1. What is the Language MySQL is been written with?
  • MySQL – C, C++
  • SQL parser – Yacc.
  1. Mention technical specifications of MySQL?
  • Drivers
  • JSON Support
  • Graphical Tools
  • Flexible structure
  • High performance
  • Geo-Spatial Support
  • OLTP and Transactions
  • MySQL Enterprise Monitor
  • MySQL Enterprise Security
  • Manageable and easy to use
  • Replication & High-Availability
  • Manageability and Ease of Use
  • Replication and high availability
  • Security and storage management
  1. What are the Data Types in PHP?
Under Compound types
  • Array
  • Object
  • Callable
Under Scalar types
  • Float
  •  String
  • Integer
  • Boolean
Under Special types
  • Null
  • Resource
  1. Mention the frameworks in PHP?
  • Yii 2
  • Symfony
  • CakePHP
  • CodeIgniter
  • Zend Framework
  1. What is unset() ?
An unset() function sets variable to “undefined”.
  1. What are the three main error types?
  • Fatal
  • E-Notices
  • E-Warnings
  1. How will you get an IP address for a client?
$_SERVER[“REMOTE_ADDR”];
  1. What is the explode function?
It can convert the string to an array with the delimiter.
  1. How do you stop the execution of the PHP Script?
By using Exit(); function.
  1. Define the Implode function.
Implode function is converse of the Explode function. It implodes the array into a string. These are the Basic PHP and MySQL Interview Question and Answers that are asked to freshers in an Interview.
  1. What are the Consonants in PHP?
-FILE- -LINE- -CLASS- -METHOD- -FUNCTION-
  1. Mention the table name that is present in MySQL?
  • ISAM
  • Heap
  • Merge
  • MyISAM
  • INNO DB
  1. What are the uses of PHP?
  • It can gather the data from files, save those data to a file and also we can send those data through email.
  • One could delete, add, and modify elements within the database by using PHP.
  • We can access the cookies variables.
  1. List the pro features of PHP MySQL?
  • Data Security
  • On-Demand Scalability
  • High Performance
  • Round-the-clock
  • Complete Workflow Control
  • Flexibility on Open Source
  • Comprehensive Transactional Support
  1. Define PHP 5?
This is a Server Script language. It is used in making dynamic and interactive web pages. Besides, it is a free and useful alternative for its competitor like Microsoft’s ASP.
  1. Define Static Websites.
The content of a Static Website could not be changed once if we run the scripts. Also, we can’t change anything on this site as they are predefined.
  1. What are Dynamic Websites?
The scripts of the Dynamic websites could be changed at run time. The content is regenerated constantly after the user’s visit or reloads.
  1. What are the Magic Functions that are available in the PHP?
_destruct() _call() _get() _set() _isset() _unset() _construct() _sleep() _clone() _invoke() _to string _wakeup() _set-state() _debuginfo()
  1. How do you stop executing a PHP Script?
exit(); function.
  1. What is an isset () function?
It is used for checking whether the variable is set and if it is not null.
  1. What is the way to destroy the variable or object?
Unset() function.
  1. What is the MIME types is required for sending the attachment mail?
Multipart/ mixed.
  1. What are the various types of triggers that are possible in MySQL?
  • Before Insert
  • After Insert
  • Before Delete
  • After Delete
  • Before Update
  • After Update
  1. What is the session time of PHP?
It will last for 24 minutes(1440 seconds).
  1. Mention the uses of PHP and MySQL?
PHP: It is the scripting language and used in Web Development. MySQL: MySQl is a Relational Database Management System.
  1. What is a TEXT and Blob in MySQL?
Blob: It is the acronym of the large binary object. It is used in holding the amount of variable data. Text:  It is the case-sensitive Blob. Text values are not binary strings. It has a character set, values stored and compared to based on the relation of a character set.
  1. What are the types of Blob?
  • BLOB
  • TINYBLOB
  • LONGBLOB
  • MEDIUMBLOB
  1. What are the types of TEXT in MySQL?
  • TEXT
  • TINY TEXT
  • MEDIUM TEXT
  • LONGTEXT
  1. Name the variable’s scope in PHP?
  • Local Scope
  • Global Scope
  • Static Scope
  1. How would you redirect the page in PHP?
header(“Location:HomePage.php”); These are the Basic PHP and MySQL Interview Questions that are asked to a fresher and Experienced candidate in an Interview.
  1. List any three Disadvantages of MySQL?
  •  They are not sufficient for large scale databases.
  • MySQL cannot support STORED PROCEDURES and COMMIT function version which is lesser than 5.0.
  • The functionality of MySQL is primarily dependent on the addons.
  1. How to destroy a cookie?
By setting cookies in the past.
  1. What are the possible ways to pass the variable via navigation between pages?
    • GET/QueryString
    • POST
  1. What is the one main distinction between PHP4 and PHP5
PHP5 can present various additional Object-Oriented Programming (OOP) features compared to PHP4.
  1. What is the function used in removing the escape characters from the string?
stripslashes function.
  1. What are the functions used in sorting the Array?
  • Sort()
  • asort()
  • arsort()
  •  ksort()
  • rsort()
  •  usort()
  • natsort()
  • natcasesort()
  • uksort()
  •  array_multisort()
  1. Which method is used in sending the Simple Mail Transfer Protocol using PHP?
mail($EmailAddress, “Subject”, $MessageBody);.
  1. From the statements that are given below which one is correct?
When $x = null;
  • empty($x) return TRUE
  • isset($x) return FALSE
  • is_null($x) return FALSE
None of the Statements are correct.
  1. What is the immediate way to escape the incoming data?
We can enable the magic quote entry on the configuration file of the PHP.
  1. Mention the method that is used in tweaking a object’s cloning behavior?
__clone() These are the Basic PHP and MySQL Interview Question and Answers that are asked to a fresher in an Interview.
  1. How can you get the recent date of MySQL?
For getting the current date, we could use the following syntax, SELECT CURRENT_DATE();
  1. What is the default port number of MySQL?
3306 is the default port number of MySQL
  1. Name the tools through which we could draw E- diagrams for MySQL.
  • Case Studio
  • Smart Draw
  1. List a few functions of the Imap?
  • imap_body – Reads the body message
  • imap_check – Checks the current mailbox
  • imap_delete – Marks the message for deletion from the present mailbox
  • imap_mail – Sends an email as a message.
  1. What are the current versions of MySQL and PHP?
Current versions of MySQL and PHP are
  • MySQL – 5.0
  • PHP – 5.1 Beta
  1. What are the types of Array in PHP?
  • Indexed Array
  • Associative Array
  • Multi-Dimensional Array
  1. What are the built-in functions that will add value to the end of an array?
  • into_array()
  • inend_array()
  • array_push()
  • array_unshift()
  1. What are the features of PHP7?
  • Spaceship operator
  • Generator delegation
  • Anonymous classes
  • Closure:: call method
  • Group use declaration
  • Scalar type declarations
  • Return type declarations
  • Null coalescing operator (??)
  • Constant arrays using define()
  • Generator return expressions.
  1. List the Content Management Systems in PHP?
  • WordPress
  • Joomla
  • Magento
  • Drupal
  1. How many columns we can create for the index?
For a Standard Table, we can create 16 indexed columns. These are the Common PHP Interview Questions that are asked to Experienced candidate in an Interview.
  1. How can you check whether the value of the given variable is number or not?
We can use is_numeric for checking whether they are number or not.
  1. What function can be used in determining whether a file exists?
  • feof()
  • is_readable()
  • file_exists()
  • is_file_exists()
  1. Which of the following is not a valid Simple XML Parser method?
  • simplexml_import_dom()
  • simplexml_import_sax()
  • simplexml_load_file()
  • simplexml_load_string()
The function simplexml_import_sax() is not valid.
  1. How objects are passed either by reference or value?
Passed by value.
  1. How to pass variable by value?
We can put the “&” Ampersand in front of the value.
  1. What is the query for displaying the top 20 rows?
Select* From table_name Limit 0 -20;
  1. Define the Associative Array.
The Array with Strings as an index is known as an associative array.
  1. From the below statements which of the following would produce the value of “83” as their output?
  • echo intval(“0123”, 8);
  • echo intval(“0123”);
  • echo (int) 083
echo intval(“0123”, 8); will produce 83 as their output.
  1. Define Multidimensional Array.
An Array which contains more than 1 array is called a Multidimensional array. Also, the values can be accessed using various indices.
  1. Elucidate SQL Injection?
The SQL injection is code injection technique. It is used in attacking data-driven applications
  1. From the below cURL which of them is not a valid parameter PHP?
  • CURLOPT_RETURNTRANSFER
  • CURLOPT_GET
  • CURLOPT_POST
CURLOPT_RETURNTRANSFER is not the valid cURL.
  1. Name the functions that are used for searching the strings using the POSIX-style regular expression?
  • sql_regcase()
  • eragi_replace()
  • ereg_replace()
  • spliti()
  • erag()
sql_regcase() and ereg_replace() functions are used.
  1. How can we sort array in the reverse order?
By using “ksort”.
  1. What is the role of MySQL check?
It is a Client program that is used in checking the integrity of the database tables.
  1. What is TimeStamp?
They are the data type that can show the automatically generated binary numbers.Timestamp is used as the mechanism for the version of stamping table rows. Join PHP Training in Bangalore at FITA and upskill your knowledge in PHP programming language with market-relevant skills.
  1. Mention the advantages of the InnoDB over MyISAM?
  • The Advantages include,
  • Transactions
  • Row-level locking
  • Crash Recovery
  • Foreign key Constraints.
  1. Which one is not a valid method in PHP XML DOM?
  • geElementByName()
  • removeChild()
  • geElementById()
  • appendChild()
geElementById() is not a valid method in the PHP XML DOM.
  1. What is the role of a LAMP in PHP?
It is the combination of Linux, Apache, PHP, and MySQL.
  1. What is the meaning of Self in PHP?
It is the Self keyword that is used in accessing the static methods and properties.
  1. Explain MySQL dump?
This is the client program and it creates logical database backups. These are the Basic MySQL Interview Questions that are asked to a fresher and experienced candidate in an Interview.
  1. What is the Scope level in PHP?
  • Private
  • Public
  • Protected
  1. What is the limit of the identifiers in MySQL?
  • Table 64bytes
  • Index 64 bytes
  • Column 64 bytes
  • Database 64 bytes
  • Alias 255 bytes
  1. How can we identify the current session ID?
session_id()
  1. Can PHP support different inheritances?
No
  1. What are the various types of operators available in PHP?
  • Union
  • Union All
  • Minus
  • Intersect
  1. Explain White Box Testing?
It deals with tables, schema, data model, and referential integrity rules. They also deal with a logical view supporting database consistency, triggers, and ACID properties.
  1. Elucidate CTE?
Common Table Expression consists of a temporary set of results which are defined in the SQL statement.
  1. List the encryption functions that are available in PHP?
  • crypt()
  • Mcrypt()
  • hash()
  1. What are the various types of print functions that are available in PHP?
  • print() Function
  • printf() Function
  • echo() Function
  • print_r() Function
  • sprintf() Function
  1. Explain Composer in PHP?
It is the package manager for the application-level in PHP. Composer permits you to declare libraries depending on the project and also they will allow you to update. These are the Common PHP and MySQL Interview Questions that are asked to freshers and experienced candidates in an Interview.
  1. What is an action attribute in the HTML form?
It determines the place where to send a form-data on the form-submission.
  1. How would you protect the special characters in the query string?
We can protect using urlencode() function.
  1. What is Exception::getmessage?
It permits us to receive the Exception message.
  1. How would you remove the white-space from the start till the end of the $string variable?
We can use trim($string);
  1. Mention the default time session in PHP?
Until we close browser.
  1. Differentiate between PHP and Java
Criterion PHPJava
Deployment areaServer-Side Scripting languageGeneral Purpose Programming language
Supports Rich APIsNoYes
Language TypeDynamically typedStatically typed.
  1. Differentiate between HTML and PHP?
HTML is the language that is used in describing the browser to display the text and objects in the browser window. HTML mostly works on client computers and they are not a programming language. Whereas PHP is a scripting language and it could be used in creating web pages that are written in HTML.
  1. Elucidate polymorphism in PHP?
It describe patterns in object-oriented programming. Where the classes have multiple functionality when sharing the common interface.
  1. Mention the use of die in PHP?
This function prints the message, exists in the current script.
  1. Write the syntax of the mail() function in PHP?
mail($to,$subject,$message,$headers)These are the Basic PHP and MySQL Interview Questions and Answers that are asked to a fresher in an Interview
  1. List the general MYSQL functions?
  • NOWO
  • CURRDATEO
  • CONCAT (X, Y)
  • DATEDIFF (X, Y)

In the coming days, we would add the number of Interview Questions to this blog. For more details regarding PHP and MySQL refer to our website.

We provide training for PHP Training in Chennai at FITA provides professional training to the students with certification. We also have various branches across Chennai.

Other Interview Questions



Quick Enquiry