What are the differences between include() and include_once
() functions?

Answers were Sorted based on User's Feedback



What are the differences between include() and include_once () functions?..

Answer / anjali ashok arote

include()function is more time consuming because of redeclaration is more in include() file ...
where as include_once()function only declare one time...
in include()function refreshment of file is needed many time
but in include_once()function refreshment of page is only one time

Is This Answer Correct ?    0 Yes 0 No

What are the differences between include() and include_once () functions?..

Answer / nishit

file1.php:
function check()
{
echo 'hello nishit';
}
file2.php
include('file1.php');
check();

file3.php
include('file1.php');[this is worn we should use here
include once.]
include('file2.php');
check();

while execute file3.php see what the error:

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More PHP Interview Questions

How to implement a class named dragonball. This class must have an attribute named ballcount (which starts from 0) and a method ifoundaball. When ifoundaball is called, ballcount is increased by one. If the value of ballcount is equal to seven, then the message you can ask your wish is printed, and ballcount is reset to 0. How would you implement this class?

0 Answers  


How to read a file in php?

0 Answers  


What is the difference between $_files['userfile']['name'] and $_files['userfile']['tmp_name']?

0 Answers  


Tell me what are magic methods?

0 Answers  


hello experts good morning to everyone ! at present am now learning LAMP course sir( linux, apache,mysql and php) after finishing this course can i create my own website without investment is it possible ? please can any one tell sir and also tell me how can i upload my project after finishing the project in internet ? please tell the ways sir please send ur valuable suggestions to kiranpulsar2007@gmail.com

2 Answers  






Is PHP an open source software?

0 Answers  


how to overcome server time behind twleve hours compare to local system time

0 Answers  


Do you know how to enable error reporting in php?

0 Answers  


Tell me what does the php error 'parse error in php - unexpected t_variable at line x' means?

0 Answers  


Whether One-line comment begin with pound sing(#) in php?

2 Answers  


What are the advantages of php mysql?

0 Answers  


Is it worth learning php in 2019?

0 Answers  


Categories