Lorenzdakid Posted February 12, 2012 Share Posted February 12, 2012 I'm not very good at php, but this is my full code. I'm not sure what the problem is. If anyone could give me a hand, I would surely appreciate it. Line 77 in the last line of the this code. <html> <head> <title>Ace!</title> </head> <body> <h1>Ace!</h1> <h3>Demonstrates if statement</h3> <?php $begin = rand(1,10); print "You picked roman number $begin"; printNumber16($begin); printNumber110($begin); function printNumber16($begin){ global $begin; if ($begin == 1 ){ print "I"; } else if ($begin == 2){ print "II"; } else if ($begin == 3){ print "III"; } else if ($begin == 4){ print "IV"; } else if ($begin == 5){ print "V"; } else { print "I don't know what you talking bout broham"; } function printNumber110($begin) { global $begin; switch ($begin){ case 1: $roman = "I"; break; case 2: $roman = "II"; break; case 3: $roman = "III"; break; case 4: $roman = "IV"; break; case 5: $roman = "V"; break; case 6: $roman = "VI"; break; default: print "This is an illegal die!"; } print "<br>"; print "<br>"; print "You chose roman number $roman"; print "<br>"; print "<br>"; ?> <br> Refresh this page in the browser to roll another die. </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/256978-parse-error-syntax-error-unexpected-end-in-line-77/ Share on other sites More sharing options...
codebyren Posted February 13, 2012 Share Posted February 13, 2012 You are missing a closing curly brace for your printNumber110 function. The switch statement inside this function closes fine but not the function itself. Quote Link to comment https://forums.phpfreaks.com/topic/256978-parse-error-syntax-error-unexpected-end-in-line-77/#findComment-1317384 Share on other sites More sharing options...
AyKay47 Posted February 13, 2012 Share Posted February 13, 2012 also, what is the point of declaring $begin as global in your function when it is being passed into the functions scope via parameter list? doesn't make sense, not a good practice, don't do it. Quote Link to comment https://forums.phpfreaks.com/topic/256978-parse-error-syntax-error-unexpected-end-in-line-77/#findComment-1317402 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.