downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.grapheme-stripos.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.intl.grapheme.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.grapheme-stripos.php',
   
1 => 'grapheme_stripos',
  ),
 
'up' =>
  array (
   
0 => 'ref.intl.grapheme.php',
   
1 => 'Grapheme Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.grapheme-extract.php',
   
1 => 'grapheme_extract',
  ),
 
'next' =>
  array (
   
0 => 'function.grapheme-stristr.php',
   
1 => 'grapheme_stristr',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.grapheme-stripos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">grapheme_stripos</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">grapheme_stripos</span> &mdash; <span class="dc-title">Find position (in grapheme units) of first occurrence of a case-insensitive string</span></p>

 </div>
 <a name="function.grapheme-stripos.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <p class="para">Procedural style</p>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><b>grapheme_stripos</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$haystack</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$needle</tt></span>
   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$offset</tt></span>
  ] )</div>

  <p class="para rdfs-comment">
   Find position (in grapheme units) of first occurrence of a case-insensitive string
  </p>
 </div>


 <a name="function.grapheme-stripos.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">haystack</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The string to look in. Must be valid UTF-8.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">needle</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The string to look for. Must be valid UTF-8.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">offset</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The optional $offset parameter allows you to specify where in haystack to
       start searching as an offset in grapheme units (not bytes or characters). If not given, the default is zero. 
       The position returned is still relative to the beginning of haystack
       regardless of the value of $offset.
      </p>
     </dd>

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

  
 
 <a name="function.grapheme-stripos.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the position as an integer. If needle is not found, grapheme_stripos() will return boolean FALSE.  
  </p>
 </div>

 
 <a name="function.grapheme-stripos.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <div class="example">
   <p><b>Example #1 <b>grapheme_stripos()</b> example</b></p>
   <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$char_a_ring_nfd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"a\xCC\x8A"</span><span style="color: #007700">;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;'LATIN&nbsp;SMALL&nbsp;LETTER&nbsp;A&nbsp;WITH&nbsp;RING&nbsp;ABOVE'&nbsp;(U+00E5)&nbsp;normalization&nbsp;form&nbsp;"D"<br /></span><span style="color: #0000BB">$char_o_diaeresis_nfd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"o\xCC\x88"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;'LATIN&nbsp;SMALL&nbsp;LETTER&nbsp;O&nbsp;WITH&nbsp;DIAERESIS'&nbsp;(U+00F6)&nbsp;normalization&nbsp;form&nbsp;"D"<br /></span><span style="color: #0000BB">$char_O_diaeresis_nfd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"O\xCC\x88"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;'LATIN&nbsp;CAPITAL&nbsp;LETTER&nbsp;O&nbsp;WITH&nbsp;DIAERESIS'&nbsp;(U+00D6)&nbsp;normalization&nbsp;form&nbsp;"D"<br /><br /></span><span style="color: #007700">print&nbsp;</span><span style="color: #0000BB">grapheme_stripos</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$char_a_ring_nfd&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$char_a_ring_nfd&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$char_o_diaeresis_nfd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$char_O_diaeresis_nfd</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <p class="para">The above example will output:</p>
  <div class="example-contents screen">
<div class="cdata"><pre>
2
</pre></div>
  </div>
 </div>


 <a name="function.grapheme-stripos.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.grapheme-stristr.php" class="function" rel="rdfs-seeAlso">grapheme_stristr()</a> - Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack.</li>
    <li class="member"><a href="function.grapheme-strpos.php" class="function" rel="rdfs-seeAlso">grapheme_strpos()</a> - Find position (in grapheme units) of first occurrence of a string</li>
    <li class="member"><a href="function.grapheme-strripos.php" class="function" rel="rdfs-seeAlso">grapheme_strripos()</a> - Find position (in grapheme units) of last occurrence of a case-insensitive string</li>
    <li class="member"><a href="function.grapheme-strrpos.php" class="function" rel="rdfs-seeAlso">grapheme_strrpos()</a> - Find position (in grapheme units) of last occurrence of a string</li>
    <li class="member"><a href="function.grapheme-strstr.php" class="function" rel="rdfs-seeAlso">grapheme_strstr()</a> - Returns part of haystack string from the first occurrence of needle to the end of haystack.</li>
    <li class="member">
     <a href="http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries" class="link external">&raquo;
      Unicode Text Segmentation: Grapheme Cluster Boundaries
     </a>
    </li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites