2College4Knowledge
Home
Interview Questions
Group Discussion Topics
Quiz Questions
Aptitude
Free Aptitude Tests
Cookie usage
Contact Us
Interview Questions on PHP|PHP Interview Questions
Page Contents of Interview Questions on PHP
Preparation for Interview Questions on PHP
Interview Questions on PHP basic concepts
Interview Questions on PHP fundamentals and Objective questions
Other exiting content in our website
Aptitude Questions
Group Discussion Topics
Questions on JAVA
Questions on Database
Free Aptitude Tests
Increase Calculation speed
You are currently reading
PHP OBJECTIVE INTERVIEW QUESTIONS 1
similar content
PHP Interview Questions-1
PHP Interview Questions-2
PHP Interview Questions-3
PHP Interview Questions-4
Q1 . What is PHP?
Check Answer
SOLUTION
It stands for Pre hypertext processor and is one of the most widely used server side scripting languages.It is an open source and free to use.
Q2 . How do you initialize the code?
Check Answer
SOLUTION
In a webpage all the content inside the <?php ?> is php code and is executed as per its semantics.
Q3 . How do you create variables in PHP?
Check Answer
SOLUTION
We create variables just by $variable
All the variables are also used with $ for accessing the value
For example
$a=2;
Q4 . How do you create a connection in PHP?
Check Answer
SOLUTION
The mysqli() function is used to create a function to the server.
Example of a connection
$conn = new mysqli($name_of_server, $user_name, $pass_code);
Q5 . How do you import another file in PHP?
Check Answer
SOLUTION
We can import a file from a location by using include.
Example
<?php include 'dir1/file1.php' ?>
Q6 . How to read a file in PHP?
Check Answer
SOLUTION
There are two ways to read a file
we can simply use the readfile() function to read the contents of the file
example readfile("testfile.php").
Second we can use the fopen() function and open the file in read mode
fopen("testfile.php","r")
Q7 . How to break a line in PHP?
Check Answer
SOLUTION
We can use the <br> tag inside an echo
echo '<br>';
We can use".PHP_EOL".
We can also use the nl2br() funtion to break the strings into different lines.
Q8 . what are arrays and how to use them in PHP?
Check Answer
SOLUTION
Arrays are a collection of data of the same data type.
We can intialise arrays like $subj = array("Maths", "science", "social science");
we can display the values using the $subj[0] to access the first element.
Q9 . What are associative arrays in PHP?
Check Answer
SOLUTION
These are arrays that store the keys and values corresponding to it.
$subj = array("maths"=>"100", "science"=>"99");
We can get the marks obtained in maths by
subj['maths']
Q10 . What is the use of Filters in PHP?
Check Answer
SOLUTION
The use of filters is to restrict and clean the data if it has unwaranted characters.
Restrict part is to avoid the data from entering
The cleaning part is if entered then clean it up to avoid damage
One example of a filter and sanitize function is filter_var($input, FILTER_SANITIZE_STRING)
This will remove all the HTML elements from the string.
You are Currently reading
PHP Interview Questions-1
for more Interview Questions on PHP
PHP Interview Questions-1
PHP Interview Questions-2
PHP Interview Questions-3
PHP Interview Questions-4
Check out our other content
Technical Interview Questions
Objective Interview Questions on C Programming
Objective Interview Questions on Computer Networks
Objective Interview Questions on C++ Programming
Objective Interview Questions on Database Management Systems
Objective Interview Questions on Java Programming
Objective Interview Questions on Operating Systems
Objective Interview Questions on Unix Shell
Objective Interview Questions on Web Technology
Free Aptitude Questions
Aptitude Questions on Ages
Aptitude Questions on Averages
Aptitude Questions on Boats and Streams
Aptitude Questions on Partnership
Aptitude Questions on Profit and Loss
Aptitude Questions on Time and Work
Aptitude Questions on Time Speed and Distance
Aptitude Questions on Trains
Free Aptitude Tests
Aptitude Test on Ages
Aptitude Test on Averages
Aptitude Test on Boats and Streams
Aptitude Test on Partnership
Aptitude Test on Profit and Loss
Aptitude Test on Time and Work
Aptitude Test on Time Speed and Distance
Aptitude Test on Trains
Group Discussion Topics
Group discussion points on demonetization
Group discussion points on digitalization
Group discussion points on educational system in india
Group discussion points on effects of peer pressure in life
Group discussion points on flexible work culture flexible time and place
Group discussion points on globalization leading to global warming
Group discussion points on jingoism effects on globalization
Group discussion points on obesity and health impact
Free Quiz Questions
Question General Knowledge