What is the difference between include and include_once ?
Which is one is good in terms of performance ?

Answers were Sorted based on User's Feedback



What is the difference between include and include_once ? Which is one is good in terms of perform..

Answer / abhishek dilliwal

u may include a single file several times by using
include() but by using include_once() its ensured tht the
specific file would be included only once no matter how
many times u wrote it ;)

-Abhishek Dilliwal
http://abhishek.x10hosting.com

Is This Answer Correct ?    13 Yes 2 No

What is the difference between include and include_once ? Which is one is good in terms of perform..

Answer / ankit

By Using include() function we can include a file any
number of times.But if you will face a Fatal error that is
a connect() or any function can not be redeclared then just
use include_once(), it will include that file only once,
then it doesn't matter how many times u include that
file. :)

Is This Answer Correct ?    5 Yes 3 No

Post New Answer

More PHP Interview Questions

What is a persistent cookie in php?

0 Answers  


Write a function that takes "depth" as argument and return sum of node's data of that depth. For instance, (0) depth 0 / \ (10) (20) depth 1 / \ (40) (50) depth2 If I pass get_sum_by_depth(2) , it would return 90 (i.e. 40 + 50 )

0 Answers   Amazon,


Explain me differences between get and post methods?

0 Answers  


Tell me how can we pass the variable through the navigation between the pages?

0 Answers  


Can you use both this () and super () in a constructor?

0 Answers  


How to redirect a page in php?

0 Answers  


What type of errors can be occurred in php?

0 Answers  


How can we change the maximum size of the files to be uploaded?

0 Answers  


Which php mvc framework is best?

0 Answers  


What is implode() in php?

0 Answers  


What is return in php function?

0 Answers  


The left association operator % is used in PHP for?

0 Answers  


Categories