PHP Syllabus
• HTML
• Introduction to HTML
• HTML Tags
• Creating Forms
• Creating tables
• Managing home page
• CSS
• Introduction to CSS
• Three ways to use CSS
• CSS Properties
• Designing website
• Working with Templates
Java Script
• Introduction to Javascript
• Three ways to use Javascript
• Working with events
• Client-side Validation
JQuery
• Introduction to JQuery
• Validation using JQuery
• JQuery Forms
• JQuery Examples
• AJAX
• Introduction to AJAX
• PHP with AJAX
• Working with database
PHP
• Evaluation of Php
• Basic Syntax
• Variable,Operators,Keywords
• If-If,If-Else,Nested-If,Switch Case
• For While do While Foreach Loop
• Array
• Functions
• Handling Html Form With Php
• Redirecting a form after submission
• GET and POST
• Include and Require
• Working with file and Directories
• File Upload
• PHP Validations
• PHP Filters
• Reading data from XML
MySQL
• Database basics
• Indexes, PHP MyAdmin Connect & Pconnect
• MySQL Create, MySQL Insert, MySQL Select
• MySQL Update, MySQL Delete, MySQL Truncate, MySQL Drop
• Function,Subquery
Advance PHP
• Class,Object,Method
• Magic Methods
• Inheritance
• Abstract class and Interface
• Polymorphism
• static and Final
• Inner classes
• Exception Handling
• HTML
• Introduction to HTML
• HTML Tags
• Creating Forms
• Creating tables
• Managing home page
• CSS
• Introduction to CSS
• Three ways to use CSS
• CSS Properties
• Designing website
• Working with Templates
Java Script
• Introduction to Javascript
• Three ways to use Javascript
• Working with events
• Client-side Validation
JQuery
• Introduction to JQuery
• Validation using JQuery
• JQuery Forms
• JQuery Examples
• AJAX
• Introduction to AJAX
• PHP with AJAX
• Working with database
PHP
• Evaluation of Php
• Basic Syntax
• Variable,Operators,Keywords
• If-If,If-Else,Nested-If,Switch Case
• For While do While Foreach Loop
• Array
• Functions
• Handling Html Form With Php
• Redirecting a form after submission
• GET and POST
• Include and Require
• Working with file and Directories
• File Upload
• PHP Validations
• PHP Filters
• Reading data from XML
MySQL
• Database basics
• Indexes, PHP MyAdmin Connect & Pconnect
• MySQL Create, MySQL Insert, MySQL Select
• MySQL Update, MySQL Delete, MySQL Truncate, MySQL Drop
• Function,Subquery
Advance PHP
• Class,Object,Method
• Magic Methods
• Inheritance
• Abstract class and Interface
• Polymorphism
• static and Final
• Inner classes
• Exception Handling
PHP Interview Questions and answer
1.What is PHP?
PHP is an open source server side scripting language commonly used for web applications.
2.What is Open Source Software?
Software in which the source codes are freely used, modify, and shared by anyone are called Open Source Software.
These can also be distributed under licenses that adhere with the Open Source Definition.
3.What is the difference between include(), include_once() and require_once()
The include() statement includes and evaluates a specified line i.e. it will include a file based in the given path. require() does the same thing expect
upon failure it will generate a fatal error and halt the script whereas include() will just gives a warning and allow script to continue. require_once() will check
if the file already has been included and if so it will not include the file again.
4.Differences between GET, POST and REQUEST methods ?
GET and POST are used to send information from client browser to web server. In case of GET the information is send via GET
method in name/value pair and is URL encoded. The default GET has a limit of 512 characters. The POST method transfers the information via HTTP
Headers. The POST method does not have any restriction in data size to be sent. POST is used for sending data securely and ASCII and binary type’s data.
The $_REQUEST contains the content of both $_GET, $_POST and $_COOKIE.
5.What are the different errors in PHP?
There are 4 basically types of error.
Parse Error – Commonly caused due to syntax mistakes in codes e.g. missing semicolon, mismatch brackets.
Fatal Error – These are basically run time errors which are caused when you try to access what can’t be done. E.g. accessing a dead object, or trying to use a function that hasn’t been declared.
Warning Error – These occurs when u try to include a file that is not present, or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.
Notice Error – These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.
6. What type of operation is needed when passing values through a form or an URL?
If we would like to pass values througn a form or an URL then we need to encode and to decode them using htmlspecialchars() and urlencode().
7. How can PHP and Javascript interact?
PHP and Javascript cannot directly interacts since PHP is a server side language and Javascript is a client side language. However we can exchange variables since PHP is able to generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.
8. What is needed to be able to use image function?
GD library is needed to be able execute image functions.
9. What is the use of the function ‘imagetypes()’?
imagetypes() gives the image format and types supported by the current version of GD-PHP.
10. What are the functions to be used to get the image’s properties (size, width and height)?
The functions are getimagesize() for size, imagesx() for width and imagesy() for height.
11..What is the purpose of _LINE_ constant?
_LINE_ − The current line number of the file.
12.What is the purpose of _FILE_ constant?
_FILE_ − The full path and filename of the file. If used inside an include,the name of the included file is returned. Since PHP 4.0.2, _FILE_ always contains an absolute path whereas in older versions it contained relative path under some circumstances.
13.What is the purpose of _FUNCTION_ constant?
_FUNCTION_ − The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
14.What is the purpose of _CLASS_ constant?
_CLASS_ − The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
15.What is the purpose of _METHOD_ constant?
_METHOD_ − The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).
16.Why do we use multipart/form-data in html form?
This is the encoding used to send image or files via form, The data will be split into multiple parts and, one for each files plus one for the text of the form body that may be sent with them.
17.What is AJAX?
AJAX (Asynchronous JavaScript and XML) is a technique which allows updating parts of a web page, without reloading the whole page. Data is exchanged asynchronously in small amounts of data with the server.
18.What is jQuery?
jQuery is a fast, small, and feature-rich JavaScript library. It is an easy-to-use API which makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across a multitude of browsers.
19.What is the difference between sql and Mysql?
SQL or Structured Query Language is a programming language designed for managing data held in a Relational Database Management System. Mysql is a open source, relational database management System.
20.Why do we use GROUP BY and ORDER BY function in mysql?
Group By is used for retrieving information about a group of data. It is generally used with some aggregate function like SUM, AVG etc. ORDER BY is used to sort the records using column name. It can sort column in both ascending and descending order.
21.How we can retrieve the data in the result set of MySQL using PHP?
1. mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
22.What is the use of explode() function ?
Syntax : array explode ( string $delimiter , string $string [, int $limit ] );
This function breaks a string into an array. Each of the array elements is a substring of string formed by splitting it on boundaries formed by the string delimiter.
23.What is the difference between explode() and split() functions?
Split function splits string into array by regular expression. Explode splits a string into array by string.
24.What is the use of mysql_real_escape_string() function?
It is used to escapes special characters in a string for use in an SQL statement
25.Write down the code for save an uploaded file in php.
if ($_FILES["file"]["error"] == 0)
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
26.How to create a text file in php?
$filename = "/home/user/guest/newfile.txt";
$file = fopen( $filename, "w" );
if( $file == false )
{
echo ( "Error in opening new file" ); exit();
}
fwrite( $file, "This is a simple test\n" );
fclose( $file );
27.How to strip whitespace (or other characters) from the beginning and end of a string ?
The trim() function removes whitespaces or other predefined characters from both sides of a string.
28.What is the use of header() function in php ?
The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
29.How to redirect a page in php?
The following code can be used for it, header("Location:index.php");
30.How stop the execution of a php scrip ?
exit() function is used to stop the execution of a page
_LINE_ − The current line number of the file.
12.What is the purpose of _FILE_ constant?
_FILE_ − The full path and filename of the file. If used inside an include,the name of the included file is returned. Since PHP 4.0.2, _FILE_ always contains an absolute path whereas in older versions it contained relative path under some circumstances.
13.What is the purpose of _FUNCTION_ constant?
_FUNCTION_ − The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
14.What is the purpose of _CLASS_ constant?
_CLASS_ − The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
15.What is the purpose of _METHOD_ constant?
_METHOD_ − The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).
16.Why do we use multipart/form-data in html form?
This is the encoding used to send image or files via form, The data will be split into multiple parts and, one for each files plus one for the text of the form body that may be sent with them.
17.What is AJAX?
AJAX (Asynchronous JavaScript and XML) is a technique which allows updating parts of a web page, without reloading the whole page. Data is exchanged asynchronously in small amounts of data with the server.
18.What is jQuery?
jQuery is a fast, small, and feature-rich JavaScript library. It is an easy-to-use API which makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across a multitude of browsers.
19.What is the difference between sql and Mysql?
SQL or Structured Query Language is a programming language designed for managing data held in a Relational Database Management System. Mysql is a open source, relational database management System.
20.Why do we use GROUP BY and ORDER BY function in mysql?
Group By is used for retrieving information about a group of data. It is generally used with some aggregate function like SUM, AVG etc. ORDER BY is used to sort the records using column name. It can sort column in both ascending and descending order.
21.How we can retrieve the data in the result set of MySQL using PHP?
1. mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
22.What is the use of explode() function ?
Syntax : array explode ( string $delimiter , string $string [, int $limit ] );
This function breaks a string into an array. Each of the array elements is a substring of string formed by splitting it on boundaries formed by the string delimiter.
23.What is the difference between explode() and split() functions?
Split function splits string into array by regular expression. Explode splits a string into array by string.
24.What is the use of mysql_real_escape_string() function?
It is used to escapes special characters in a string for use in an SQL statement
25.Write down the code for save an uploaded file in php.
if ($_FILES["file"]["error"] == 0)
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
26.How to create a text file in php?
$filename = "/home/user/guest/newfile.txt";
$file = fopen( $filename, "w" );
if( $file == false )
{
echo ( "Error in opening new file" ); exit();
}
fwrite( $file, "This is a simple test\n" );
fclose( $file );
27.How to strip whitespace (or other characters) from the beginning and end of a string ?
The trim() function removes whitespaces or other predefined characters from both sides of a string.
28.What is the use of header() function in php ?
The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
29.How to redirect a page in php?
The following code can be used for it, header("Location:index.php");
30.How stop the execution of a php scrip ?
exit() function is used to stop the execution of a page
