Jump to content

function error


somiadiscon

Recommended Posts

could you please tell me there is an error says line five error i want to make a function that will display some text but i couldn't :) Parse error: parse error, unexpected T_STRING in c:\PHP\uploadtemp\Copy.php on line 12<?php function about() { // this declares a function and gives it a name of about, the () is used for arguments but we will not b needing those for this. echo("Hello, My name is John Doe and I am X years old. My Life's goal is to be a goalkeeper... bye now!"); // echo("");means that PHP should display this text. in this case some random message } this is a closing bracket teling PHP to end the function. about(); // to display all of that text now all we need to do is put the name of the function: about(); Don't forget the semi-colon afterabout();otherwise you'll get a bunch of errors ?>

Link to comment
Share on other sites

He's right, your comments are messed up. You can use comments one of two ways:

<?php function about() {   // this declares a function and gives it a name of about, the () is used for arguments but we will not b needing   //those for this.  echo("Hello, My name is John Doe and I am X years old. My Life's goal is to be a goalkeeper... bye now!");  // echo("");  //means that PHP should display this text. in this case some random message } //this is a closing bracket teling PHP to end the function. about(); // to display all of that text now all we need to do is put the name of the function: about(); Don't forget the // semi-colon after// about();// otherwise you'll get a bunch of errors ?>

<?php function about() {   /*this declares a function and gives it a name of about, the () is used for arguments but we will not b needing   those for this.*/  echo("Hello, My name is John Doe and I am X years old. My Life's goal is to be a goalkeeper... bye now!");  /* echo("");  means that PHP should display this text. in this case some random message */} /* this is a closing bracket teling PHP to end the function. */about(); /* to display all of that text now all we need to do is put the name of the function: about(); Don't forget the semi-colon afterabout();otherwise you'll get a bunch of errors */?>

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