PHP Important Interview questions and answers
Today, We want to share with you PHP Important Interview questions and answers.
In this post we will show you PHP Interview questions and answers for freshers, hear for Important interview questions with answers for php freshers we will give you demo and example for implement.
In this post, we will learn about PHP Basic Interview Questions for freshers with answers with an example.
What is PHP?
Simple PHP defination : PHP is a server side scripting language . It is commonly used for web-applications , and web-api and real time application to data maintain. and Other Means Personal Home Page.
What is the Simple use of “echo” in php?
echo Keywords used to simple print a data in the webpage in browser, Example: The following simple code print the text browser in the webpage
<?php echo 'PHP King'; ?> <?php echo 'PHP Master for Pakainfo.com'; ?>
How to simple include a file to a php page?
We can used to include a file using simple “include() ” keywords or “require()” keywords function with all file path as It is a parameter.
What is the difference between include and require method?
If the file is not found to used by require(),and then it will cause a fatal error generated and halt the execution of the this script. If the file is (404 error)not found used by include() method, a simple warning will be issued generated, but execution will be continue.
Differences between GET form submit and POST submit methods ?
We can send approx.1024 bytes using simple GET method for used by form submit but POST method can all transfer large or more amount of data and used bt the POST method is the secure method than GET method.
How to declare an array in php?
Eg : var $array_languages = array('Laravel', 'Angularjs', 'vuejs'); print_r($array_languages);
What is the basic use of ‘print’ in php?
This is not actually a real time function, It is a simple language construct. So you can basic use with out parentheses with It is simple argument list.
Example print('php interview questions and answers for freshers pdf'); print 'php interview questions and answers for experienced');
What is use of in_array() function in php ?
The basic used in_array used to checks array if a value exists in an array.
What is use of count() function in php ?
The count() function is used to count all data elements in an any array, or something in an object data.
How to set cookies in PHP?
Setcookie(“Laravel”, “Angularjs”, time()+3600);
How to Retrieve a Cookie Value?
eg : echo $_COOKIE["user"]; echo $_COOKIE["userid"];
what types of loops exist in php?
The list of exist in php. Like as a for,while,do while and foreach
What are the different errors in PHP?
There are Main three error display
- Fatal errors:
what is sql injection ?
The one type of SQL injection is a malicious simple srcipt code injection technique. and It is exploiting SQL vulnerabilities and most useful secure in Web applications
How to get the value of current session id?
The session_id() function basically returns the sessiond data id for the current session generated returns.
How to delete a file from the system
In server side to Unlink() function used to deletes the given file and from the your file system.
What are the encryption techniques in PHP
There are two different types of encryption format Like as a MD5 and mcrypt_encrypt
What is the use of “ksort” array in php?
ksort array is used for sort an array by key in simple reverse order.
What is the difference between $var and $$var?
They are both sample variables. But simple changes $var is a variable with a simple fixed name. and then $$var is a variable who is name is stored in $var find. For example,
if $var contains “datamessage”,
$$var is the same as $datamessage.
How send email using php?
Send Mail in only used to your server not localhost (Like as a wampp,xampp server to send mail) mail($to,$subject,$message,$headers);
How do you define a constant?
The Basic Using define() simple directive, like define as (“MYCONSTANT”,150)
What is the use of “enctype” format attribute in a html form?
file transfer and send temp file to used to “multipart/form-data”.
What is defination by an associative array?
Associative arrays basic words are arrays that use the string keys is called to the associative arrays.
what is the use of isset() in php?
This isset() function is used to allow determine if a variable is set check and is not NULL check
How to redirect a page in php?
The following code can be used for it.
//redirect particular location header("Location:index.php");
How stop the execution of a php scrip ?
The exit() function is used to simple stop the execution of a page.
How to set a simple page as a home page in a php based site ?
The index.php file is the default web application name of the home page in your project in php based web-sites.
How to find the length of a string?
Simple PHP strlen() function used to find all the length of a string.
How to print current date and time?
<?php //print date and time echo date('Y-m-d H:i:s'); ?> [php] <h3>How do we get the current session ID?</h3> [php] <?php //start the session session_start(); //print session id echo session_id(); ?>
How do we destroy a session?
<?php //start the session session_start(); //destroy the session session_destroy(); ?>
What is CSS?
The CSS or cascading Style Sheet is a main way to style and present view the HTML page.
The main Top 10 topics in PHP that you can expect questions
- PHP Different Types of Like as Loops ( For, Do, While ).
- module of array : Arrays ( Creation, Searching , Different types , sorting ).
- PHP String functions ( Explode, search etc ).
- PHP formated Date & time.
- php maintain Session & Cookies.
- supported Mail function.
- used without page refresh Ajax & Curl.
- include File handling (Like as Create, delete, write ).
- support Image & File upload.
- Loop Termination Keywords Like as a( Break, Continue, exit etc ).
We hope you get an idea about PHP Important Interview questions and answers
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.
We hope This Post can help you…….Good Luck!.