TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-01-2009, 11:22 PM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default Anonymous Functions in PHP 5.3.0, deprecates create_function

I've seen in PHP 5.3.0 which has been recently released, allows for anonymous functions assigned to variables, so instead of doing this:

Example #1
PHP Code:
function Add($a,$b) { return $a $b; }

$A 'Add';
$var1 2;
$var2 2;

printf('%d'$A($var1,$var2)); 
Example #2
PHP Code:

$A 
create_function('$args''return $args[0] + $args[1];');

printf('%d'$A(2,2)); 

We can do:
PHP Code:
$A = function($a$b) {
 return 
$a $b;

which I like this a lot, reminds me a lot like javascript, i hope this can be done with classes aswell, like so:
PHP Code:

$A
::MyMethod = public static function( $a$b ) { return $a b; } 
On-Topic about PHP 5.3 aswell, I tried to install it on xampp, but I still happen to get a parse error by trying to do the simplest of putting in "namespace Project;". even though the module is loaded in apache ( at least in the config )
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
what are all the subjects in php? sarmenhb General 7 01-21-2008 05:41 PM
Tutorial: PHP and OOP, a beginners guide Village Idiot Tips & Tricks 0 09-06-2007 04:23 PM


All times are GMT. The time now is 04:33 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design