Tutorial :Can we use include (”TheWalkin.php”) two times in a PHP page “makeit.PHP”?



Question:

I it possible to include two times a page called walkin in a page makeit.php


Solution:1

Yes.

But the code will be executed twice.

If you only want it to be included once, use the aptly named include_once.

Problems may occur if you define functions or classes or connections twice. Why do you want to include twice?


Solution:2

It depends. PHP's include() acts like a copy and paste, so your question is equivalent to "Can we copy and paste 'TheWalkin.php' two times in a PHP page?

If there are no function or class definitions in TheWalkin.php, yes.

EDIT: Maybe you want to look at this: include_once. It makes sure you are only include a file once.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »