Jump to content

Error With Helloworld


yrstruly

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...