<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.closure.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'closure.fromcallable.php',
    1 => 'Closure::fromCallable',
    2 => 'Converts a callable into a closure',
  ),
  'up' => 
  array (
    0 => 'class.closure.php',
    1 => 'Closure',
  ),
  'prev' => 
  array (
    0 => 'closure.call.php',
    1 => 'Closure::call',
  ),
  'next' => 
  array (
    0 => 'class.stdclass.php',
    1 => 'stdClass',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/predefined/closure/fromcallable.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="closure.fromcallable" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Closure::fromCallable</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.1.0)</p><p class="refpurpose"><span class="refname">Closure::fromCallable</span> &mdash; <span class="dc-title">Converts a callable into a closure</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-closure.fromcallable-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Closure::fromCallable</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>): <span class="type"><a href="class.closure.php" class="type Closure">Closure</a></span></div>

  <p class="para rdfs-comment">
   Create and return a new <a href="functions.anonymous.php" class="link">anonymous
   function</a> from given <code class="parameter">callback</code> using the
   current scope. This method checks if the <code class="parameter">callback</code> is
   callable in the current scope and throws a <span class="classname"><a href="class.typeerror.php" class="classname">TypeError</a></span>
   if it is not.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    As of PHP 8.1.0, <a href="functions.first_class_callable_syntax.php" class="link">First class callable syntax</a> has the same semantics as this method.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-closure.fromcallable-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">callback</code></dt>
    <dd>
     <p class="para">
      The callable to convert.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-closure.fromcallable-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns the newly created <span class="classname"><a href="class.closure.php" class="classname">Closure</a></span> or throws a
   <span class="classname"><a href="class.typeerror.php" class="classname">TypeError</a></span> if the <code class="parameter">callback</code> is
   not callable in the current scope.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-closure.fromcallable-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><a href="functions.anonymous.php" class="link">Anonymous functions</a></li>
   <li><a href="functions.first_class_callable_syntax.php" class="link">First class callable syntax</a></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>