note 125356 added to migration70.new-features
| From: | JulianSawicki@php.net | Date: | Sat, 12 Sep 2020 13:52:55 +0000 |
| Subject: | note 125356 added to migration70.new-features | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215105@lists.php.net to get a copy of this message | ||
In php 7.0 it's possible to curry functions in a way that's similar to JavaScript.
<?php
// A curried function
function add($a) {
return function($b) use ($a) {
return $a + $b;
};
}
// Invoking curried function in PHP 7
$result = add(10)(15);
var_dump($result); // int 25
?>
Currying in this way is not possible in php 5.6.
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.167.36 (proxied: 82.197.213.176)
----
Manual Page -- http://php.net/manual/en/migration70.new-features.php
Edit -- https://master.php.net/note/edit/125356
Del: integrated -- https://master.php.net/note/delete/125356/integrated
Del: useless -- https://master.php.net/note/delete/125356/useless
Del: bad code -- https://master.php.net/note/delete/125356/bad+code
Del: spam -- https://master.php.net/note/delete/125356/spam
Del: non-english -- https://master.php.net/note/delete/125356/non-english
Del: in docs -- https://master.php.net/note/delete/125356/in+docs
Del: other reasons-- https://master.php.net/note/delete/125356
Reject -- https://master.php.net/note/reject/125356
Search -- https://master.php.net/manage/user-notes.php