Skip to content

Add note about first-class callables to callable type and add link to the closure documentation page #4792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions language/types/callable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
<title>Passing</title>

<para>
A PHP function is passed by its name as a <type>string</type>. Any built-in
or user-defined function can be used, except language constructs such as:
<function>array</function>, <function>echo</function>,
A PHP function is passed by either its name as a <type>string</type> or by
a <link linkend="functions.first_class_callable_syntax">first-class callable</link>.
Any built-in or user-defined function can be used, except language constructs
such as: <function>array</function>, <function>echo</function>,
<function>empty</function>, <function>eval</function>,
<function>exit</function>, <function>isset</function>,
<function>list</function>, <function>print</function> or
Expand Down Expand Up @@ -125,7 +126,7 @@ call_user_func($c, 'PHP!');
<para>
<example>
<title>
Callback example using a Closure
Callback example using a <link linkend="class.closure">Closure</link>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, why do we have <type> and <function> but not <class>?

</title>
<programlisting role="php">
<![CDATA[
Expand Down