Okay I am new to PHP, well getting it to run. The programming part is fine, it is very similar to python, ruby, etc... so no trouble there. So here is my problem. I made a class, and all it has is a function that writes test to the browser page.

<?php
    class Test{
    
        function Test(){}
        
        public function test(){
            echo "Test \n";
        }
    }
?>

and I made a html doc that would just use that script that I did, but I dont think I did it right, so how would I use that in an html doc?
Thanks

You don't, really. You serve a PHP file, not an HTML file. The PHP file you serve would have to call your function at some point, but you know that.

PHP, like with other web languages, runs through a "filter" before the user gets it. The filter renders the HTML by "running" the PHP.

Okay, thanks for the help.
PHP files only work with other PHP files, and I just need to make a php file with html code in it.

Correct. You can more or less have a complete HTML file, and include PHP here and there between the PHP delimiters. However, for any of the PHP to function, you save the file with a ".php" extension.

I do that for a page on my site, where it's completely xhtml except for an RDF feed. The only php on the page is the call to the RDF parser, which outputs HTML.

However, for that one function call to work, the file is served as a PHP, not HTML.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.