# Executing a php.file twice from a parent php.file

**URL:** <https://www.phphelp.com/t/executing-a-php-file-twice-from-a-parent-php-file/22097>\
**Category:** General PHP Help\
**Created:** [February 13, 2014, 2:50am UTC](https://www.phphelp.com/t/executing-a-php-file-twice-from-a-parent-php-file/22097 "2014-02-13T02:50:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [February 13, 2014, 2:50am UTC](https://www.phphelp.com/t/executing-a-php-file-twice-from-a-parent-php-file/22097/1 "2014-02-13T02:50:18Z")

</div>

I need to execute a php.file twice that has functions defined from a parent php.file. Something like this:

- 
- My code
- 

include(php.file);  
\*

- More my code
- 

include(php.file);  
\*

- More my code
- 

The problem with include or require is the second execution tries to declare functions that were defined the first time around, a fatal error. The “include” php file is huge (10,000+ lines) and not modifiable. I pass information to the “include” file by:

$\_POST[‘var1’] = “asdf”;

My question is how to accomplish this? Any help would be most appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [February 13, 2014, 5:42am UTC](https://www.phphelp.com/t/executing-a-php-file-twice-from-a-parent-php-file/22097/2 "2014-02-13T05:42:28Z")

</div>

Include\_once comes to mind but without knowing more I can’t suggest a better approach.

---

<div class="post-metadata">

**Author:** ![Redscouse](https://www.phphelp.com/user_avatar/www.phphelp.com/redscouse/32/124_2.png) [@Redscouse](https://www.phphelp.com/u/Redscouse)\
**Post date:** [February 13, 2014, 8:01am UTC](https://www.phphelp.com/t/executing-a-php-file-twice-from-a-parent-php-file/22097/3 "2014-02-13T08:01:07Z")

</div>

have a read of this, not sure if it’s what you need for this particular issue.  
[Reflection](http://www.php.net/manual/en/book.reflection.php)  
Red 😉
