PHP Interview Questions and Answers

The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.

PHP Interviews are getting tough these days as the technology grows faster. To get through the PHP interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed PHP questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on PHP and various other technologies interview preparation.



Next >>

 

1. Are objects passed by value or by reference?

Everything is passed by value.


2. Explain the ternary conditional operator in PHP?

Expression preceding the ? is evaluated, if it?s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.


3. For printing out strings, there are echo, print and printf. Explain the differences.

echo is the most primitive of them, and just outputs the contents following the construct to the screen. print is also a construct (so parentheses are optional when calling it), but it returns TRUE on successful output and FALSE if it was unable to print out the string. However, you can pass multiple parameters to echo, like: and it will output the string "Welcome to TechInterviews!" print does not take multiple parameters. It is also generally argued that echo is faster, but usually the speed advantage is negligible, and might not be there for future versions of PHP. printf is a function, not a construct, and allows such advantages as formatted output, but it?s the slowest way to print out data out of echo, print and printf.


4. How come the code works, but doesn?t for two-dimensional array of mine?

Any time you have an array with more than one dimension, complex parsing syntax is required. print "Contents: {$arr[1][2]}" would?ve worked.


5. How do I accomplish that with PHP?

On large strings that need to be formatted according to some length specifications, use wordwrap() or chunk_split().


Your Ad Here

6. How do I find out the number of parameters passed into function?

func_num_args() function returns the number of parameters passed in.


7. How do you call a constructor for a parent class?

parent::constructor($value)


8. How do you define a constant?

Via define() directive, like define ("MYCONSTANT", 100);


9. How do you match the character ^ at the beginning of the string?

^\^


10. How do you pass a variable by value?

Just like in C++, put an ampersand in front of it, like $a = &$b


Your Ad Here

Next >>

 
Databases Questions and Answers
 
DB2 Interview Questions and Answers
IMS Interview Questions and Answers
MYSQL Interview Questions and Answers
Oracle Interview Questions and Answers
PL/SQL Interview Questions And Answers
Quel Interview Questions and Answers
SQL Interview Questions and Answers

 
 
.NET Interview Questions and Answers
 
ASP Interview Questions and Answers
C# Interview Questions and Answers
Visual Basic Interview Questions and Answers
 
J2EE Interview Questions and Answers
 
Enterprise Java Beans (EJB) Interview Questions And Answers
Hibernate Interview Questions And Answers
Jave Messaging Service (JMS) Interview Questions And Answers
Jave Server Faces (JSF) Interview Questions And Answers
Java Server Pages (JSP) Interview Questions And Answers
Servlets Interview Questions And Answers
Spring Framework Interview Questions And Answers
Struts Framework Interview Questions And Answers
 
JAVA Interview Questions and Answers
 
Core Java Interview Questions and Answers
Java Platform, Micro Edition (Java ME) Interview Questions And Answers
JAVA GUI Interview Questions and Answers
Java Performance Tuning Interview Questions And Answers
JUnit Interview Questions And Answers
Remote Method Invocation (RMI) Interview Questions And Answers
Unified Modeling Language (UML) Interview Questions And Answers
 
Java Application Server Interview Questions And Answers
 
Tomcat Application Server Interview Questions And Answers
WebLogic Application Server Interview Questions And Answers
 
Mainframe Interview Questions and Answers
 
CICS Interview Questions and Answers
COBOL Interview Questions and Answers
IMS Interview Questions and Answers
JCL Interview Questions and Answers
REXX Interview Questions and Answers
TELON Interview Questions and Answers
VSAM Interview Questions and Answers
 
Object Oriented Language Questions and Answers
 
C Interview Questions and Answers
C++ Interview Questions and Answers
Eiffel Interview Questions and Answers
J2EE Interview Questions and Answers
JAVA Interview Questions and Answers
Sather Interview Questions and Answers
Small talk Interview Questions and Answers
 
Operation Systems Interview Questions and Answers
 
MS DOS Interview Questions and Answers
Unix OS Interview Questions and Answers
Windows Interview Questions and Answers
 
Scripting languages Interview Questions and Answers
 
Java Script Interview Questions and Answers
Practical Extraction and Reporting Language Interview Questions and Answers
PHP Interview Questions and Answers
VBScript Interview Questions and Answers
 
UserInterfaces Questions and Answers
 
Foxit Interview Questions and Answers
Glade Interview Questions and Answers
Tweak Interview Questions and Answers
 
WEB Technologies Questions and Answers
 
AJAX Interview Questions and Answers
HTML Interview Questions and Answers
WML Interview Questions and Answers
XML Interview Questions and Answers
 
Interview Tips And Some Common Questions
 
Behavioral Interview Questions And Answers


Your Ad Here