somiadiscon Posted August 7, 2006 Share Posted August 7, 2006 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 More sharing options...
skym Posted August 7, 2006 Share Posted August 7, 2006 What error and which is the line 5?I guess it must be where the closing bracket is, the text after it isn't commented (those //). Link to comment Share on other sites More sharing options...
justsomeguy Posted August 7, 2006 Share Posted August 7, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now