Sunday, 18 August 2013

How include in php works?

How include in php works?

I have file a.php and data folder in one folder. In data folder, I create
two files: b.php and c.php. Content of each file
a.php
<?php
$a = 1;
include('data/b.php');
?>
b.php
<?php
include('data/c.php');
?>
c.php
<?php
echo $a;
?>
When I run file a.php, result is 1. But I change content of file b.php to
include('c.php'); the result of file a.php is also 1, I think it it show
an error because file a.php and file c.php is not in one folder. Thank
you.

No comments:

Post a Comment