PHP General Questions & Answers

Here’s a great explanation of some common questions from people who are learning PHP. The author discusses the differences among the include(), include_once() and require() statements and also talks about the differences between if() and switch() statements. Good food for thought, so I’m reblogging it for my friends.

Web Development

Question1: What are the differences between require and include, include_once?
File will not be included more than once. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.

The major difference between include() and require() is that in failure include() produces a warning message whereas require() produces a fatal errors.

Question2: What are the differences between include() and include_once() functions?
Answer: include_once() will use the specified file only once. include and require will use the specified file as many time we want. If include_once() is used before with same name, it can not done again

Question3: What is difference between echo and print?
Answer: print and echo are more or less the same; they are both language constructs that display stringsā€¦

View original post 106 more words

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s