[doc-en] master: Clarify the example (#6159)
| From: | Mikhail Alferov via GitHub | Date: | Thu, 26 Nov 2026 16:05:03 +0000 |
| Subject: | [doc-en] master: Clarify the example (#6159) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-24024@lists.php.net to get a copy of this message | ||
Author: Mikhail Alferov (mmalferov)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-26T17:05:00+01:00
Commit: https://github.com/php/doc-en/commit/a8bfeea36a821f895dc4bd928d8001d55f408421
Raw diff: https://github.com/php/doc-en/commit/a8bfeea36a821f895dc4bd928d8001d55f408421.diff
Clarify the example (#6159)
* Clarify the example
The current example does not show the re-evaluation of the arrow function body
* Update functions.xml
Changed paths:
M language/functions.xml
Diff:
diff --git a/language/functions.xml b/language/functions.xml
index 6e0b5648fcf9..d5f2029fa7c5 100644
--- a/language/functions.xml
+++ b/language/functions.xml
@@ -1955,10 +1955,14 @@ function greet(string $name, string $time): string
$arrow = fn(string $name) => greet($name, now());
echo "Arrow function created\n";
echo $arrow('Alice');
+echo $arrow('Alice');
+
+echo "\n====\n\n";
$partial = greet(?, now());
echo "Partial application created\n";
echo $partial('Bob');
+echo $partial('Bob');
?>
]]>
</programlisting>
@@ -1968,9 +1972,15 @@ echo $partial('Bob');
Arrow function created
now() called
Hello Alice, it is 12:00
+now() called
+Hello Alice, it is 12:00
+
+====
+
now() called
Partial application created
Hello Bob, it is 12:00
+Hello Bob, it is 12:00
]]>
</screen>
</example>