PHP function not executing.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FacJoe
Forum Newbie
Posts: 8
Joined: Sun Dec 07, 2008 7:49 pm

PHP function not executing.

Post 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.
User avatar
Peter Anselmo
Forum Commoner
Posts: 58
Joined: Wed Feb 27, 2008 7:22 pm

Re: PHP function not executing.

Post 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.
Post Reply