Script not working?

I have xampp installed, I have a document with this code:

<html>
<body>

<?php
function myCompanyMotto(){
echo "We deliver quantity, not quality!<br />";
}
echo "Welcome to Tizag.com <br />";
myCompanyMotto();
echo "Well, thanks for stopping by! <br />";
echo "and remember... <br />";
myCompanyMotto();
?>

</body>
</html> 

named index.php in the htdocs folder, I type http://localhost/index.php in my browser and don’t see the above? Does the XAMPP Control panel need to be opened before I can see any scripts on my browser or does it have to be opened at all or does it not matter if it’s open or closed or any other reason why I am not seeing the code’s output in my browser?

If you start up the server and point your browser to
http://127.0.0.1
do see it?

xampp is already opened and SVC boxes for both Apache and MYSQL are checked and both services shows “running”. When I do what you say, same deal
but now when I refresh the browser page now I am seeing:

Hello World

I am wondering if localhost is pointing to the file named index.php in the php folder and not the file of the same name which is in the htdocs folder? No, that would not make sense because thos words are not in any of the index.php files, strange, isn’t the a utility somewhere where I can post php ocde to test like jslint does with javascript?

I’m guessing the “hello world” you’re seeing is the page XAMPP shows to let you know you’ve installed it OK. That’s not altogether bad, at least you got that far.

You probably missed doing something(s) during configuration.

On Windows?
Did you run setup_xampp.bat ?

I can’t remember how I installed xampp but it say it installed correctly and I was able to run a script on it before.