1. What is use of header() function in php ?
Answer :- 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.
2. List out the predefined classes in PHP?
3. What type of inheritance that PHP supports?
Answer :- In PHP an extended class is always dependent on a single base class,that is, multiple inheritance is not supported. Classes are extended using the keyword ‘extends’.
4. How do you define a constant?
Constants in PHP are defined using define() directive, like define(“MYCONSTANT”, 100);
5. How do you pass a variable by value in PHP?
Just like in C++, put an ampersand in front of it, like $a = &$b;
6. What does a special set of tags = and ?> do in PHP?
Answer :- The output is displayed directly to the browser.
7. How do you call a constructor for a parent class?
Answer :- parent::constructor($value)
8. 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.
9. What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
10. How many ways can we get the value of current session id?
session_id() returns the session id for the current session.
11. What are default session time and path?
default session time in PHP is 1440 seconds or 24 minutes
Default session save path id temporary folder /tmp
12. for image work which library?
we will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with.
13. How can we get second of the current time using date function?
14. 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
15. 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”;