Q.1 What type of inheritance that php supports?.
Ans: PHP supports only single inheritance.But multiple inheritance can be implemented in php through use of interface.Q.2 What’s the special meaning of __sleep and __wakeup?
Ans: __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.Q.3 Would you initialize your strings with single quotes or double quotes?
Ans: Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.Q.4 How come the code <?php print "Contents: $arr[1]"; ?> works, but <?php print "Contents: $arr[1] [2]"; ?> doesn’t for two-dimensional array of mine?
Ans: Any time you have an array with more than one dimension, complex parsing syntax is required. print "Contents: {$arr[1][2]}" would’ve worked.Q.5 What is the difference between echo and print?
Ans:echo:
Is a command only.
Faster than print
print:
Is a function.
It will return true(1) or false(0) or some values.Q.6 POST and GET Methods : Which will execute faster POST or GET? Explain?
Ans: Once most important difference is when you are sending the form with GET method. It displays name/value pair used in the form at the address bar of the browser preceded by url.Whereas if you send the form with POST method then user can not see that information and Secondly When you want to send short or small data & Less Sensitive Data then you can use GET Method. But for long data & Sensitive Data sending say more then 100 character you can use POST methodQ.7 What’s the difference between htmlentities() and htmlspecialchars()?
Ans: htmlspecialchars only takes care of <, >, single quote ‘, double quote " and ampersand.htmlentities translates all occurrences of character sequences that have different meaning in HTML.
Q.8 How do you define a constant?
Ans: Via define() directive, like define ("MYCONSTANT", 100);Q.9 Explain the ternary conditional operator in PHP?
Ans: Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.Q.10 What does a special set of tags <?= and ?> do in PHP?
Ans: The output is displayed directly to the browser.Q.11 What’s the difference between include and require?
Ans: It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.Q.12 How do you pass a variable by value?
Ans: Just like in C++, put an ampersand in front of it, like $a = &$bQ.13 Difference between require() and include()?
Ans: if filepath not found .. require() teriminates the program and gives fatal error but include() not teriminate the program it gives warning msg and continues to program.Q.14 What are cron jobs? Explain in details. ?
Ans: CRON is the name of program that enables UNIX users to execute commands orscripts (groups of commands) automatically at a specified time/date. It is
normally used for sys admin commands like makewhatis which builds a search
database for the man -k command or for running a backup script but can be used
for anything. A common use for it today is connecting to the internet and
downloading your email.
Q.15 What is the diffrence between Notify URL and Return URL?.
Ans: Notify URL: The URL to which PayPal posts information about the transaction via Instant Payment Notification. Must be URL-encoded. Its an optional field have maximum 256 characters length.Q.16 How do I find out the number of parameters passed into function?
Ans: func_num_args() function returns the number of parameters passed in.Q.17 what are the various methods to pass data from one web page to another web page ?
Ans:1.POST
2.GET
3.SESSION
4.COOKIES
5.QUERY STRING