Hello everybody,
I have been struggling to solve a simple problem for more than 4 hours.
I have a php file which is called convertor.php that contains a function to convert some date. I have another file called show.php which contains a function called show_date().
show_date() calls the function inside convertor.php and returns an integer.
When I call show_date() from the same file, everything is correct, but when I call this function from another file, it gives me a weird number.
I found a very interesting situation which looks like this:
show.php
PHP Code:
include_once 'convertor.php';
function show_date()
{
....
...
call some function in convertor.php
return $x;
}
$f=show_date();
print $f;
everything is correct. Now let's have a look at my other file.
other_file.php
PHP Code:
include_once 'show';
$h=show_date();
print $h;
it gives me wrong answer. It also shows me the result of calling show_date() inside show.php incorrectly. As I know, when I include a php file and call one of its functions, it shouldn't run anything other than called function.
I will really appreciate if you let me know how I can fix this problem.
Thanks.