Jump to content

Error With Helloworld


Recommended Posts

HiI have the following code which is giving me this error: Parse error: parse error, expecting `T_FUNCTION' in C:\xampp\htdocs\exercise\HelloWorld.php on line 13Please help?<?php # Script 6.1 - HelloWorld.php /* This page defines the HelloWorldclass.4 * The class says "Hello, world!" indifferent languages.5 */ class HelloWorld { // This method prints a greeting. // It takes one argument: the language to use. // Default language is English. function say_hello ($language ='English') { // Put the greeting withinP tags. echo '<p>'; // Print a message specific to alanguage. switch ($language) { case 'Dutch': echo 'Hello, wereld!'; break; case 'French': echo 'Bonjour, monde!'; break; case 'German': echo 'Hallo, Welt!'; break; case 'Italian': echo 'Ciao, mondo!'; break; case 'Spanish': echo '¡Hola, mundo!'; break; case 'English': default: echo 'Hello, world!'; break; } // End of switch. // Close the HTML paragraph. echo '</p>'; } // End of say_hello() function. } // End of HelloWorld class. ?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...