besanttechnologies Flashcards
Interview
What is PHP?
PHP is a server side scripting language. It requires a web server to perform execution like Apache, IIS etc. It helps to create a dynamic web applications. PHP is a market leader in-terms of usage. It holds more than 82% of total web market share as of 2015.
Who is the father of PHP?
Rasmus Lerdorf. He created PHP in the year of 1994.
Acronym of PHP?
Now PHP stands for “PHP : Hypertext Preprocessor“. Before PHP 4 it was called as “Personal Home Page Tools”.
Explain the difference between static and dynamic websites?
Static Websites : A webpage or website which was developed by using HTML alone.
Dynamic Websites : A webpage or website which was developed by using any dynamic languages like PHP, ASP.NET, JSP etc
What is the name of scripting engine in PHP?
ZEND Engine 2 is the name of the scripting engine that powers PHP.
What are the methods of form submitting in PHP?
We can use GET (or) POST for form submission in PHP.
What is a session?
A session is a logical object enabling us to preserve temporary data across multiple PHP pages. A PHP session is no different from a normal session. It can be used to store information on the server for future use. However this storage is temporary and is flushed out when the site is closed.
What is the method to register a variable into a session?
< ?php session_register($name_your_session_here); ?>
What are the encryption functions in PHP?
md5() – Calculate the md5 hash of a string
sha1() – Calculate the sha1 hash of a string
hash() – Generate a hash value
crypt() – One-way string hashing
What are the different types of errors in PHP?
There are 3 types of errors in PHP.
Notices : These are the non-critical errors. These errors are not displayed to the users.
Warnings : These are more serious errors but they do not result in script termination. By default, these errors are displayed to the user.
Fatal Errors : These are the most critical errors. These errors may be a cause of immediate termination of script.
What is the difference between $besant and $$besant?
$besant stores variable data while $$besant is used to store variable of variables.
$besant stores fixed data whereas the data stored in $$besant may be changed dynamically.
How do you connect MySQL database with PHP?
There are two methods to connect MySQL database with PHP. Procedural and Object Oriented style.
Difference echo() and print()?
Echo can output one or more string but print can only output one string and always returns 1.
Echo is faster than print because it does not return any value.
Differentiate between require and include?
Require and include both are used to include a file, but if file is not found include sends warning whereas require sends Fatal error.
What is the use of count() function in PHP?
count() function is used to count total elements in the array, or something an object.
What is the difference between session and cookie?
The main difference between session and cookies is that cookies are stored on the user’s computer while sessions are stored on the server side.
Cookies can’t hold multiple variables on the other hand Session can hold multiple variables.
You can manually set an expiry for a cookie, while session only remains active as long as browser is open.
How can you retrieve a cookie value?
echo $_COOKIE [“cookie_name”];
What is the use of header() function in PHP?
The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output. For example, you can’t print any HTML element before using this header function.
What is the array in PHP?
Array is used to store multiple values in single name. In PHP, it orders in keys and values pairs. It is not a datatype dependent in PHP.
How can you submit a form without a submit button?
Possible only by using JavaScript. You can use JavaScript submit() function to submit the form without explicitly clicking any submit button.
Explain the importance of the function htmlentities
The htmlentities() function converts characters to HTML entities.
What is MIME?
MIME – Multi-purpose Internet Mail Extensions.
MIME types represents a standard way of classifying file types over Internet.
Web servers and browsers have a list of MIME types, which facilitates files transfer of the same type in the same way, irrespective of operating system they are working in.
A MIME type has two parts: a type and a subtype. They are separated by a slash (/).
MIME type for Microsoft Word files is application and the subtype is msword, i.e. application/msword.
How can we increase the execution time of a php script?
By default the PHP script takes 30secs to execute. This time is set in the php.ini file. This time can be increased by modifying the max_execution_time in seconds. The time must be changed keeping the environment of the server. This is because modifying the execution time will affect all the sites hosted by the server.
What is Type juggle in php?
Type Juggling means dealing with a variable type. In PHP a variables type is determined by the context in which it is used. If an integer value is assigned to a variable, it becomes an integer.
E.g. $var3= $var1 + $var2
Here, if $var1 is an integer. $var2 and $var3 will also be treated as integers.