7 kyu
PHP Functions - Anonymous Functions (aka Closures)
442 of 443donaldsebleung
Loading description...
Fundamentals
Tutorials
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
This comment has been hidden.
OP solved it, closing!
what is this error for?: Parse error: syntax error, unexpected 'class' (T_CLASS) in /home/codewarrior/run.php on line 8 my code: $hello_world = function() {return 'Hello World';}; $person_description = function ($name, $age, $occupation) { return "$name is $age years old and currently works as a $occupation"; }
The "issue" tag is for problems related to the Kata itself, not your solution. Please re-raise your query as a "question" instead.
i think named func. are cleaner... and i dont get the advantage of the unnamed functions. you have a little bit more code but your code is clean.
Its true,writing unnamed function is slighty faster but code is a little messy after. If function is really simple like multiply example its good place for unnamed functions,when you know that you will not use it again. In JS alot of people use unnamed functions in sorting arrays too.
Its good to have more options how to pass/write functions :)
i agree with your opinion ;)