Reputation: 191
I would like to know if its possible to include part of text file as code in PHP not as text.
For example:
**Index.php FILE**
<?php
require "part1.php";
?>
<div>HELLO WORKD</div>
<?php
require "part2.php";
?>
**Part1.php FILE:**
<?php
if(0==0) {
Part2.php FILE:
}
?>
Part2.php FILE
<?php
}
?>
Upvotes: 1
Views: 748
Reputation: 1152
Absolutely. require, require_once, include and include_once are your friends to enable this. Here is more info about each...
http://php.net/manual/en/function.require.php
http://php.net/manual/en/function.require-once.php
http://php.net/manual/en/function.include.php
http://php.net/manual/en/function.include-once.php
Upvotes: 2