Page 1 of 1

PHP function not executing.

Posted: Mon Dec 08, 2008 6:15 pm
by FacJoe
Hi. Another newbie question.

I have this following code in PHP:

Code: Select all

 
<?php
function ThisIsATest()
{
    print "Test";
    echo "Hello";
}
?>
A very simple code. I am using Visual Studio as my code-editor for this project and I put in a break point in the "function ThisIsATest()" line. When I run the code, the debugger skips over the "print" and "echo" functions I call inside my function.

What could be the problem?

Thanks in advance.

Re: PHP function not executing.

Posted: Mon Dec 08, 2008 7:34 pm
by Peter Anselmo
What you have there is a function definition. You need to also "call" the function for it to run. To call it, just insert "ThisIsATest();" somewhere in your code.