1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-30 11:42:14 +02:00
Files
archived-doc-ru/language/predefined/closure/call.xml
Sergey Panteleev 6d43fd64d7 Исправление форматирования
[skip-spellcheck]
[skip-lint]
2022-12-27 03:42:36 +03:00

106 lines
2.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 9c74079f12d67cabb52c124d761f48275417d7eb Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="closure.call" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Closure::call</refname>
<refpurpose>Связывает и запускает замыкание</refpurpose>
</refnamediv>
<refsect1 role="description"><!-- {{{ -->
&reftitle.description;
<methodsynopsis role="Closure">
<modifier>public</modifier> <type>mixed</type><methodname>Closure::call</methodname>
<methodparam><type>object</type><parameter>newThis</parameter></methodparam>
<methodparam rep="repeat"><type>mixed</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
Временно связывает замыкание с <parameter>newThis</parameter> и вызывает его с
заданными параметрами.
</para>
</refsect1><!-- }}} -->
<refsect1 role="parameters"><!-- {{{ -->
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>newThis</parameter></term>
<listitem>
<para>
Объект (<type>object</type>) для привязки к замыканию на время его вызова.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
Ноль или больше параметров, которые передаются замыканию.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1><!-- }}} -->
<refsect1 role="returnvalues"><!-- {{{ -->
&reftitle.returnvalues;
<para>
Возвращает возвращаемое значение замыкания
</para>
</refsect1><!-- }}} -->
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Пример <function>Closure::call</function></title>
<programlisting role="php">
<![CDATA[
<?php
class Value {
protected $value;
public function __construct($value) {
$this->value = $value;
}
public function getValue() {
return $this->value;
}
}
$three = new Value(3);
$four = new Value(4);
$closure = function ($delta) { var_dump($this->getValue() + $delta); };
$closure->call($three, 4);
$closure->call($four, 4);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(7)
int(8)
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->