I have a file (test.php) that includes another file (includes/test.inc.php) to perform a function.
I have never used funtions before so must some stupid reason that i can't figure out..
😕:mad:
the directory structure is:
htdocs
|--test.php
|--includes
|--|--test.inc.php
test.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TEST</title>
</head>
<body>
<?php
include("includes/test.inc.php")
$a = test();
echo $a;
?>
</body>
</html>
include.inc.php
<?php
function test(){
echo "function test called.";
$value = "function test result";
return $value;
}
The resulting page is blank. the first file works (eg if i remove the include etc, and just put echo "something"; it will print on the screen normally.
there must be something wrong in the way I call the function or the way I include the file, but can't understand what!
Can you help me please?