Parse Error Syntax Error Unexpected T_return Expecting T_function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the syntax error unexpected 'return' (t_return) laravel company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Parse Error: Syntax Error, Unexpected 'return' (t_return)
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up syntax error, unexpected T_RETURN, expecting T_FUNCTION oop php [closed] up vote 2 down vote favorite Im receiving an error as stated above. Its referring to my return statement. Any one got any clues on this?! Thankful for all help! Regards! public function getPosts() { $result = $this->db->query("SELECT * FROM posts"); $posts = array(); while($posts = $result->fetch_assoc()) { array_push($posts, new Post($post['id'], $post['created'], $post['author'], $post['title'], $post['body'])); } } return $posts; syntax-error php share|improve this question edited Feb 23 '13 at 11:54 tereško 42.6k1567124 asked Sep 8 '10 at 12:10 Tim 1662420 closed as too localized by tereško, cryptic ツ, NikiC, PeeHaa, Dejan Marjanovic Feb 24 '13 at 2:57 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. add a comment| 2 Answers 2 active oldest votes up vote 9 down vote Your return statement should come before the last closing brace. while($posts = $result->fetch_assoc()) { array_push($posts, new Post($post['id'], $post['created'], $post['author'], $post['title'], $post['body'])); } return $posts; } share|improve this answer answered Sep 8 '10 at 12:11 BoltClock♦ 385k959371048 @Pekka: fine! :P –BoltClock♦ Sep 8 '10 at 12:16 thanks for the quick answers. I found the answer just after I posted the question :) a bit to quick on my finger I reckon. Thanks! –Tim Sep 8 '10 at 12:21 1 @Pekka the potter get scared of unicorn!!! :P –OM The Eternity Sep 8 '10 at 12:27 add a comment| up vote 1 down vote Your return statement needs to be inside the function getPosts(). Currently it is outside or yo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just http://stackoverflow.com/questions/3667556/syntax-error-unexpected-t-return-expecting-t-function-oop-php like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected T_RETURN in ___ on line 51 [closed] up vote -1 down vote favorite I'm trying to fetch a single row. $con = mysqli_connect("mydb", "joakim", "password", "db"); $sql = "SELECT *, DATE_FORMAT(dato, '%e. %b kl %H:%i') AS fdato FROM http://stackoverflow.com/questions/20069022/parse-error-syntax-error-unexpected-t-return-in-on-line-51 bidrag WHERE bidrag_id = $bidrag_id"; $query = mysqli_query($con, $sql); $row = mysqli_fetch_assoc($query) return $row; <--- This line However this makes this error message: Parse error: syntax error, unexpected T_RETURN in /iu/cube/u0/s181322/www/prosjekt/klasser/Bidrag.php on line 51 php syntax share|improve this question asked Nov 19 '13 at 10:29 joakim 404419 closed as off-topic by DCoder, andrewsi, Michael Berkowski, Tomasz Kowalczyk, nickhar Mar 13 '14 at 9:40 This question appears to be off-topic. The users who voted to close gave these specific reasons:"This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Michael Berkowski, Tomasz Kowalczyk, nickhar"Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See a
Apparel forum Discussions forum Forum record_voice_over Laracasts Podcast forum Laravel Podcast Forum General syntax error, unexpected 'return' (T_RETURN), expecting ';' or '{' syntax https://laracasts.com/discuss/channels/general-discussion/syntax-error-unexpected-return-t-return-expecting-or?page=1 error, unexpected 'return' (T_RETURN), expecting ';' or '{' webdevdea — 2 https://www.phpbb.com/community/viewtopic.php?f=46&t=1986155 years ago I am getting this error Symfony\Component\Debug\Exception\FatalErrorException …/app/controllers/TasksController.php13 The link to the code.. https://github.com/webdevdea/learningLaravel Best Answer — Thread Owner's Choice school danharper — 2 years ago https://github.com/webdevdea/learningLaravel/blob/master/app/views/home.blade.php#L44
Involved Learn how you can get involved with the project. 3.1 New Features An overview of the new features and improvements in phpBB 3.1 (The new version of phpBB). The Team Find out who is responsible for all the mayhem. Contact Us Have a question the forums don't answer? Come here. Advertising Information if you want to advertise on phpBB.com. Find out more about the project » Downloads Latest Version Download the latest stable release of phpBB Update Packages Automatic Update packages for your phpBB release Language Packs Translate phpBB into (almost) any language you like Extensions Download extensions to enhance phpBB’s functionality Styles Your forums need a new look? Browse our Styles DB Official Tools Official tools by the phpBB team to assist you with your board Customise Customisation Database Our customisation database contains just about everything you might need to customise your phpBB board to your liking. In it you will find Extensions (for 3.1.x), MODs (for 3.0.x), Styles, Language Packs, BBCodes, as well as various tools. Extensions (3.1.x) Guides on how to use them and how to create your own. Extensions DB Download or submit extensions to our extensions database. Modifications (3.0.x) Guides on how to use them and how to create your own. Modifications DB Download or submit modifications to our MODs database. Styles Guides on how to use them and to create your own styles. Styles DB Download or submit styles to our styles database. More resources on customising your board » Support Documentation Installation guide and the complete documentation. Knowledge Base Team and user submitted articles covering support areas. Flash Tutorials View Flash Tutorials that help you with the use of phpBB. phpBB Support The Support related areas in our community forums. IRC Support Old school? Visit the IRC support channel on freenode. International Support Find a 3rd party support site in your first language. More information on support » Development Area51 phpBB Development All Development Discussion takes place at Area51. Bug tracker, development wiki, continuous integration and other development tools are located here. Find out how to get involved in phpBB development. phpBB Bug Tracker Report problems with phpBB core and other sub-projects such as the Website, Customisation DB, and Team Tools here. phpBB Ideas Suggest, vote on and comment on ideas for phpBB. Security Tracker The tracker for security issues in p