top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can I include same file more then once in a PHP page?

0 votes
553 views

For example say I want include("abc.php") two times in a PHP page?

posted May 30, 2014 by Amritpal Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+1 vote

@Amrit: You can include a file as many times as you want but I would suggest you to try include_once or required_once which take care of duplicate include.

By the way why you want to include same file twice?

answer May 30, 2014 by Salil Agrawal
+1 vote

Yes ,You can include same file more than once.But It creates a problem when a file have some functions declaration. Then error may come for already declared function in this file.

answer Jun 2, 2014 by Karamjeet Singh
0 votes

Yes you can include that many times you want, but here are some things to make sure of: (Including abc.PHP, the file names are case-sensitive)

answer May 30, 2014 by Vrije Mani Upadhyay
...