1. Who is the father of PHP ?
Answer – Rasmus Lerdorf is known as the father of PHP.
2.How does PHP work?
Answer – As a web design and scripting language, you can embed PHP into HTML or HTML5 code for designing an interactive website.
If you have some web template systems, web frameworks, or web content management systems, you can also combine PHP with them.
The processing of PHP code is done by an interpreter that is handled as a module in the server or as an executable in Common Gateway Interface (CGI). It is not uncommon to see developers execute PHP code using a command-line interface.
3. What is the difference between $name and $$name?
Answer – $name is variable where as $$name is reference variable like $name=jyoti and $$name=chaurasiya so $jyoti value is chaurasiya .
4. What are the method available in form submitting?
Answer – GET and POST
5.What is the difference between GET and POST?
Answer – There are many Difference
- GET displays the submitted data as part of the URL, during POST this information is not shown as it’s encoded in the request.
- GET can handle a maximum of 2048 characters, POST has no such restrictions.
- GET allows only ASCII data, POST has no restrictions, binary data are also allowed.
- Normally GET is used to retrieve data while POST to insert and update.
6. What Is a Session?
Answer – A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.
7. What are encryption functions in PHP?
8. What is Constructors and Destructors?
CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.
DESTRUCTORS : PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.
11. What are the differences between require and include?
Both include and require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error
10. What is use of header() function in php ?
The header() function sends a raw HTTP header to a client.We can use herder()
function for redirection of pages. It is important to notice that header() must
be called before any actual output is seen.
11.What is Array in PHP ?
Answer – Array stores collection of values. You can declare array in PHP as like this.
$fruits = array(‘banana’, ‘grape’, ‘orange’);
12.What is difference between session and cookie ?
Answer – A session stores data in the server where cookie stores data in the client system in the form of a text file.
13. What’s the special meaning of __sleep and __wakeup?
Answer – __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.
15. What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
16. How can we get second of the current time using date function?
$second = date(“s”);
17. What are the Formatting and Printing Strings available in PHP?
printf()- Displays a formatted string
sprintf()-Saves a formatted string in a variable
fprintf() -Prints a formatted string to a file
number_format()-Formats numbers as strings
18. How can we find the number of rows in a result set using PHP?
$result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo “$num_rows rows found”;
19. What is the meaning of isset() function in PHP ?
Answer – It is used to understand whether a value is set to a variable or not.
20. What are the data types of PHP ?
Answer: Integers, Doubles, Booleans, NULL, Strings, Arrays, Objects, and Resources.