Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[Question] PHP Anonymous functions
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="GarettM" data-source="post: 283209" data-attributes="member: 839"><p>When would it be a good idea to use anonymous functions.</p><p></p><p>I like doing this for simple stuff like:</p><p>[PHP]</p><p><?php</p><p>$info = function() {</p><p> Return Array(</p><p> 'Example' => 'I am anonymous function'</p><p> );</p><p>};</p><p>echo $info()['Example'];</p><p>[/PHP]</p><p>I was also wondering is this a good programming habit?</p></blockquote><p></p>
[QUOTE="GarettM, post: 283209, member: 839"] When would it be a good idea to use anonymous functions. I like doing this for simple stuff like: [PHP] <?php $info = function() { Return Array( 'Example' => 'I am anonymous function' ); }; echo $info()['Example']; [/PHP] I was also wondering is this a good programming habit? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[Question] PHP Anonymous functions
Top