<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.functions.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'functions.internal.php',
    1 => 'Internal (built-in) functions',
    2 => 'Internal (built-in) functions',
  ),
  'up' => 
  array (
    0 => 'language.functions.php',
    1 => 'Functions',
  ),
  'prev' => 
  array (
    0 => 'functions.variable-functions.php',
    1 => 'Variable functions',
  ),
  'next' => 
  array (
    0 => 'functions.anonymous.php',
    1 => 'Anonymous functions',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/functions.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="functions.internal" class="sect1">
   <h2 class="title">Internal (built-in) functions</h2>
   
   <p class="para">
    PHP comes standard with many functions and constructs. There are also
    functions that require specific PHP extensions compiled in, otherwise 
    fatal &quot;undefined function&quot; errors will appear. For example, to use 
    <a href="ref.image.php" class="link">image</a> functions such as 
    <span class="function"><a href="function.imagecreatetruecolor.php" class="function">imagecreatetruecolor()</a></span>, PHP must be compiled with
    <span class="productname">GD</span> support. Or, to use
    <span class="function"><a href="function.mysqli-connect.php" class="function">mysqli_connect()</a></span>, PHP must be compiled with
    <a href="book.mysqli.php" class="link">MySQLi</a> support. There are many core functions
    that are included in every version of PHP, such as the
    <a href="ref.strings.php" class="link">string</a> and 
    <a href="ref.var.php" class="link">variable</a> functions. A call 
    to <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> or
    <span class="function"><a href="function.get-loaded-extensions.php" class="function">get_loaded_extensions()</a></span> will show which extensions are
    loaded into PHP. Also note that many extensions are enabled by default and
    that the PHP manual is split up by extension. See the
    <a href="configuration.php" class="link">configuration</a>,
    <a href="install.php" class="link">installation</a>, and individual
    extension chapters, for information on how to set up PHP.
   </p>
   <p class="para">
    Reading and understanding a function&#039;s prototype is explained within the
    manual section titled <a href="about.prototypes.php" class="link">how to read a
    function definition</a>. It&#039;s important to realize what a function
    returns or if a function works directly on a passed in value. For example,
    <span class="function"><a href="function.str-replace.php" class="function">str_replace()</a></span> will return the modified string while 
    <span class="function"><a href="function.usort.php" class="function">usort()</a></span> works on the actual passed in variable
    itself. Each manual page also has specific information for each
    function like information on function parameters, behavior changes,
    return values for both success and failure, and availability information.
    Knowing these important (yet often subtle) differences is crucial for
    writing correct PHP code.
   </p>
   <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
    <span class="simpara">
     If the parameters given to a function are not what it expects, such as 
     passing an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> where a <span class="type"><a href="language.types.string.php" class="type string">string</a></span> is expected, 
     the return value of the function is undefined. In this case it will
     likely return <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> but this is just a convention, and cannot be relied 
     upon.
     As of PHP 8.0.0, a <span class="classname"><a href="class.typeerror.php" class="classname">TypeError</a></span> exception is supposed to
     be thrown in this case.
    </span>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
    <p class="para">
     Scalar types for built-in functions are nullable by default in coercive mode.
     As of PHP 8.1.0, passing <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> to an internal function parameter that is not declared nullable
     is discouraged and emits a deprecation notice in coercive mode to align with the behavior of user-defined functions,
     where scalar types need to be marked as nullable explicitly.
    </p>

    <p class="para">
     For example, <span class="function"><a href="function.strlen.php" class="function">strlen()</a></span> function expects the parameter <code class="literal">$string</code>
     to be a non-nullable <span class="type"><a href="language.types.string.php" class="type string">string</a></span>.
     For historical reasons, PHP allows passing <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> for this parameter in coercive mode, and the parameter is
     implicitly cast to <span class="type"><a href="language.types.string.php" class="type string">string</a></span>, resulting in a <code class="literal">&quot;&quot;</code> value.
     In contrast, a <span class="classname"><a href="class.typeerror.php" class="classname">TypeError</a></span> is emitted in strict mode.
    </p>

    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">null</span><span style="color: #007700">));<br /></span><span style="color: #FF8000">// "Deprecated: Passing null to parameter #1 ($string) of type string is deprecated" as of PHP 8.1.0<br />// int(0)<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">str_contains</span><span style="color: #007700">(</span><span style="color: #DD0000">"foobar"</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">));<br /></span><span style="color: #FF8000">// "Deprecated: Passing null to parameter #2 ($needle) of type string is deprecated" as of PHP 8.1.0<br />// bool(true)<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p></blockquote>

   <div class="sect2">
    <h3 class="title">Прогляньте також</h3>
    <p class="para">
     <ul class="simplelist">
      <li><span class="function"><a href="function.function-exists.php" class="function">function_exists()</a></span></li>
      <li><a href="funcref.php" class="link">the function reference</a></li>
      <li><span class="function"><a href="function.get-extension-funcs.php" class="function">get_extension_funcs()</a></span></li>
      <li><span class="function"><a href="function.dl.php" class="function">dl()</a></span></li>
     </ul>
    </p>
   </div>
  </div><?php manual_footer($setup); ?>