Jump to content

lesson 7 video 8


zeusthegreat

Recommended Posts

function footer($argument, $arg = "Brom is god!") {

 

echo "$argument<br><br>";

 

 

if($arg == "Brom is god!") {

 

return "hey, I know " .$arg;

 

} else {

 

 

 

 

 

return "Do I know you " .$arg ."?";

 

 

}

 

 

 

 

?>

 

 

<?php

 

 

 

echo footer("stefan");

 

?>

 

 

 

 

 

 

 

 

 

</body>

</html>

 

 

have followed this lesson twice and i am suffering from mind block just cannot see where i am wrong as the errror this shows is

 

 

 

Parse error: syntax error, unexpected $end in C:\wamp\www\php_beginners\conditional_statements\function_custom_default_next.php on line 63

 

 

 

 

thankyou

Link to comment
Share on other sites

This is what the code looks like with proper tabs indicating hierarchy:

 

function footer($argument, $arg = "Brom is god!") 
{
   echo "$argument<br><br>";

   if($arg == "Brom is god!") 
   {
       return "hey, I know " .$arg;
   }
   else 
   {
       return "Do I know you " .$arg ."?";
   }
?>

<?php
echo footer("stefan");
?>

When you format the code a bit, you'll notice that you are missing a closing "}" on your footer() function. That's what the "unexpected $end" error usually indicates -- an unclosed curly bracket somewhere.

 

What program are you using to code this in? If you are using Notepad, I would suggest finding a basic code editor with syntax highlighting, which will help you spot coding errors. There are quite a few free ones available -- Notepad++ is my personal favorite when I work on Windows.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...