I'm still pretty new to PHP but I'm finding it to be a very powerful and useful language. However, I'm finding a very critical need for a feature that I've been told is available but I can't seem to get it to work properly.

So PHP has a language construct for including external PHP scripts into others, similar to include directives in C. While I've been able to use this include statement properly, what I've been finding is that functions located in this included script aren't accessible by the including file for some reason.

The domain where I'm having this problem at is within an HTML file. I need to conditionally modify the style and text of an element by retrieving certain information from a database when the page loads. The code within the PHP file to connect to and retrieve the data from the database works perfectly fine when it's not encapsulated within a function but I ideally would need this code placed within a function to be used elsewhere within the page source.

So for example, the PHP file would have something like this:

Code:
<?php
    function someFunction() {
        // DB connection/extraction code here
        return requestedInformation;
    }
?>
And then within the nested HTML file (with a .php extension obviously):

Code:
<?php include 'php_filename.php' ?>
<?php $var = someFunction(); ?>
The second line throws an error with regards to an undefined function.