(1) What is PHP?
In a Simple Words PHP is a “Hypertext Preprocessor”.
PHP is a server side scripting language most commonly used for web applications and it is embedded in HTML.
PHP scripts are executed on the server and it is free and easy to download and use. In PHP you can create dynamically web pages.
PHP has many CMS like WordPress, Joomla, Magento, Opencart for creating a website with this CMS.
(2) How to use of “echo” in php?
It is generally used for print a data in the webpages.
<?php echo ‘Test'; ?> <?php echo "<h5>Test PHP</h5>"; ?>
(3) How many ways to include file in php pages?
There are Two Ways to include file in pages like “include() ” and “require()”.
(4) Difference between require_once(), require() ?
require() checks a specific file, if that file not found then it show an error.
require_once() is recommended that file which is not being included before.
(5) What are the correct way to start and finish a PHP block of code?
(1) <?php //PHP code to be placed here ?> (2) <? //PHP code to be placed here ?>
(6) What is differences between GET and POST methods in php ?
When we use GET method in webpages, it will fetch data from a mention resource.
GET method main advantage is it remain in the browser history and also use for to bookmark any URL.
In this we can send simple text data via GET method and it allow ASCII character.
POST METHOD :
When we use POST method in webpages, it Submits data to a mention resource.
POST method main advantage is it not remain in the browser history and also not use for to bookmark any URL.
POST method has no restriction for data length and it allow binary data.
(7) What are the general uses of PHP?
Sometimes we restrict users to access some webpages of our website.
PHP can encrypt data of your website for security.
PHP also stands for Access cookies, set or access variables and set cookies.
PHP files can create, open, read, write, and close on system.
(8) Difference between Session and Cookie in php?
Sessions are stored on the Server Side files that maintain user data.
Anything can be stored in session like username,password or all other information.
Session ends when user or visitor close it’s browser and also use for login/logout.
Before using $_SESSION in php file you have to write session_start() after that Session will start.
Cookie are stored on the Client Side files that maintain user data.
You can store anything in a browser cookie and also store username and previous searched pages.
Cookie use for user tracking activity for security purpose and you can set Cookie for lifetime.
You need not to start Cookie on your machine.
(9) How to define a session in PHP?
With the use of session_start() we can initiate session.
(10) How many types of PHP variables?
Strings, Integers, Booleans, Doubles, Arrays, Null, Objects, Resources.
(11) How to define an array in php and what the types of an array?
For Example : $mix = array(“Parrot”, “Maruti”, “Potato”);
Types of an Array :
(1) Associative Arrays, (2) Indexed Arrays, (3) Multidimensional Arrays
(12) Howmany types of loops in php?
For Loop, While Loop, Foreach Loops and Do While Loop.
(13) How to set a Homepage in a php website ?
Give index.php name is the default name of the Homepage in php website.
(14) Give Different Types of run time errors in PHP?
(1) Notices, (2) Warnings, (3) Fatal errors.
(15) Howmany types of method available in form submitting in PHP?
There are two types of method available for form submitting.
(16) What’s the difference between unlink() and unset() function in PHP?
unlink() is used for delete a file from system.
unset() is used for make a variable undefined or crush variable.
(17) How to select a database in PHP?
(18) How do you to set cookies in PHP?
Setcookie(“test”, “testing”, time()+3600);
(19) How can we redirect a page in php?
For Example : header(“Location:index.php”);
(20) What’s the use of header() function in php ?
The header() perform sends a raw HTTP header to a client browser.
Remember that this perform should be referred to as before causing the particular out place.
For example, you are doing not print any hypertext mark-up language component before victimisation this perform.
(21) Main difference between include and require statements in PHP?
In include() method , only warnings are given and the script will continue to exection.
In require() method , no warnings are given and script will stop and no more output will be generated.
(22) Main difference between Echo and Print in PHP?
echo does not return any value.
it is faster then print.
print always return value 1.
it is slower than echo.