<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.stripos.php',
    1 => 'stripos',
    2 => 'Find the position of the first occurrence of a case-insensitive substring in a string',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Функції',
  ),
  'prev' => 
  array (
    0 => 'function.stripcslashes.php',
    1 => 'stripcslashes',
  ),
  'next' => 
  array (
    0 => 'function.stripslashes.php',
    1 => 'stripslashes',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/strings/functions/stripos.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.stripos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stripos</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">stripos</span> &mdash; <span class="dc-title">Find the position of the first occurrence of a case-insensitive substring in a string</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.stripos-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>stripos</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$haystack</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$needle</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$offset</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Find the numeric position of the first occurrence of
   <code class="parameter">needle</code> in the <code class="parameter">haystack</code> string.
  </p>
  <p class="para">
   Unlike the <span class="function"><a href="function.strpos.php" class="function">strpos()</a></span>, <span class="function"><strong>stripos()</strong></span> is
   case-insensitive.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stripos-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">haystack</code></dt>
     <dd>
      <p class="para">
       The string to search in.
      </p>
     </dd>
    
    
     <dt><code class="parameter">needle</code></dt>
     <dd>
      <p class="para">
       The string to search for.
      </p>
      
 <p class="para">
  До версії PHP 8.0.0, якщо параметр <code class="parameter">needle</code> не є рядком,
  він перетворюється на ціле число і розглядається як код символу. Ця поведінка
  є застарілою, починаючи з PHP 7.3.0. Вкрай не рекомендується на неї
  покладатися. Залежно від потрібної поведінки, параметр
  <code class="parameter">needle</code> необхідно привести до рядкового типу або
  обробити функцією <span class="function"><a href="function.chr.php" class="function">chr()</a></span>.
 </p>

     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       If specified, search will start this number of characters counted from
       the beginning of the string. If the offset is negative, the search will start
       this number of characters counted from the end of the string.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stripos-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns the position of where the needle exists relative to the beginning of
   the <code class="parameter">haystack</code> string (independent of offset).
   Also note that string positions start at 0, and not 1.
  </p>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the needle was not found.
  </p>
  <div class="warning"><strong class="warning">Увага</strong><p class="simpara">Ця функція може
повертати як логічне <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, так і не логічне значення, яке прирівнюється до
<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. Докладніше про це описано в розділі <a href="language.types.boolean.php" class="link">Логічні типи даних</a>. Для перевірки
значення, яке повертає ця функція, використовується <a href="language.operators.comparison.php" class="link">оператор ===</a>.</p></div>
 </div>


 <div class="refsect1 errors" id="refsect1-function.stripos-errors">
  <h3 class="title">Помилки/виключення</h3>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     If <code class="parameter">offset</code> is greater than the length of
     <code class="parameter">haystack</code>, a
     <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> will be thrown.
    </span>
   </li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.stripos-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     
 <tr>
  <td>8.2.0</td>
  <td>
   Приведення до одного регістру не залежить від локалі, що встановлена функцією
   <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>. Перетворюються тільки ASCII-символи. Байти,
   які не належать до ASCII, порівнюються за своїми значеннями.
  </td>
 </tr>


     <tr>
 <td>8.0.0</td>
 <td>
  Тепер параметр <code class="parameter">needle</code> може бути порожнім рядком.
 </td>
</tr>

     <tr>
      <td>8.0.0</td>
      <td>
       Passing an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> as <code class="parameter">needle</code> is no longer supported.
      </td>
     </tr>

     <tr>
      <td>7.3.0</td>
      <td>
       Passing an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> as <code class="parameter">needle</code> has been deprecated.
      </td>
     </tr>

     <tr>
      <td>7.1.0</td>
      <td>
       Support for negative <code class="parameter">offset</code>s has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.stripos-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>stripos()</strong></span> examples</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$findme    </span><span style="color: #007700">= </span><span style="color: #DD0000">'a'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$mystring1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'xyz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$mystring2 </span><span style="color: #007700">= </span><span style="color: #DD0000">'ABC'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$pos1 </span><span style="color: #007700">= </span><span style="color: #0000BB">stripos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring1</span><span style="color: #007700">, </span><span style="color: #0000BB">$findme</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pos2 </span><span style="color: #007700">= </span><span style="color: #0000BB">stripos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring2</span><span style="color: #007700">, </span><span style="color: #0000BB">$findme</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Nope, 'a' is certainly not in 'xyz'<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$pos1 </span><span style="color: #007700">=== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"The string '</span><span style="color: #0000BB">$findme</span><span style="color: #DD0000">' was not found in the string '</span><span style="color: #0000BB">$mystring1</span><span style="color: #DD0000">'"</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Note our use of !==.  Simply != would not work as expected<br />// because the position of 'a' is the 0th (first) character.<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$pos2 </span><span style="color: #007700">!== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"We found '</span><span style="color: #0000BB">$findme</span><span style="color: #DD0000">' in '</span><span style="color: #0000BB">$mystring2</span><span style="color: #DD0000">' at position </span><span style="color: #0000BB">$pos2</span><span style="color: #DD0000">"</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.stripos-notes">
  <h3 class="title">Примітки</h3>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: <span class="simpara">Ця функція є бінарно
безпечною.</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stripos-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-stripos.php" class="function" rel="rdfs-seeAlso">mb_stripos()</a> - Finds position of first occurrence of a string within another, case insensitive</span></li>
    <li><span class="function"><a href="function.str-contains.php" class="function" rel="rdfs-seeAlso">str_contains()</a> - Determine if a string contains a given substring</span></li>
    <li><span class="function"><a href="function.str-ends-with.php" class="function" rel="rdfs-seeAlso">str_ends_with()</a> - Checks if a string ends with a given substring</span></li>
    <li><span class="function"><a href="function.str-starts-with.php" class="function" rel="rdfs-seeAlso">str_starts_with()</a> - Checks if a string starts with a given substring</span></li>
    <li><span class="function"><a href="function.strpos.php" class="function" rel="rdfs-seeAlso">strpos()</a> - Знаходить позицію першого входження підрядка в рядку</span></li>
    <li><span class="function"><a href="function.strrpos.php" class="function" rel="rdfs-seeAlso">strrpos()</a> - Find the position of the last occurrence of a substring in a string</span></li>
    <li><span class="function"><a href="function.strripos.php" class="function" rel="rdfs-seeAlso">strripos()</a> - Find the position of the last occurrence of a case-insensitive substring in a string</span></li>
    <li><span class="function"><a href="function.stristr.php" class="function" rel="rdfs-seeAlso">stristr()</a> - Case-insensitive strstr</span></li>
    <li><span class="function"><a href="function.substr.php" class="function" rel="rdfs-seeAlso">substr()</a> - Return part of a string</span></li>
    <li><span class="function"><a href="function.str-ireplace.php" class="function" rel="rdfs-seeAlso">str_ireplace()</a> - Case-insensitive version of str_replace</span></li>
   </ul>
  </p>
 </div>


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