downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | 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 Git repository for this website on git.php.net.

Source of: /manual/fa/function.strncmp.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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 => 'fa',
  ),
 
'this' =>
  array (
   
0 => 'function.strncmp.php',
   
1 => 'strncmp',
  ),
 
'up' =>
  array (
   
0 => 'ref.strings.php',
   
1 => 'String Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.strncasecmp.php',
   
1 => 'strncasecmp',
  ),
 
'next' =>
  array (
   
0 => 'function.strpbrk.php',
   
1 => 'strpbrk',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.strncmp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strncmp</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">strncmp</span> &mdash; <span class="dc-title">Binary safe string comparison of the first n characters</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.strncmp-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><b>strncmp</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$str1</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$str2</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$len</tt></span>
   )</div>

  <p class="para rdfs-comment">
   This function is similar to <span class="function"><a href="function.strcmp.php" class="function">strcmp()</a></span>, with the
   difference that you can specify the (upper limit of the) number of
   characters from each string to be used in the comparison.
  </p>
  <p class="para">
   Note that this comparison is case sensitive.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.strncmp-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><i><tt class="parameter">str1</tt></i></span>
     <dd>

      <p class="para">
       The first string.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><i><tt class="parameter">str2</tt></i></span>
     <dd>

      <p class="para">
       The second string.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><i><tt class="parameter">len</tt></i></span>
     <dd>

      <p class="para">
       Number of characters to use in the comparison.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.strncmp-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns &lt; 0 if <i><tt class="parameter">str1</tt></i> is less than
   <i><tt class="parameter">str2</tt></i>; &gt; 0 if <i><tt class="parameter">str1</tt></i>
   is greater than <i><tt class="parameter">str2</tt></i>, and 0 if they are
   equal.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.strncmp-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.preg-match.php" class="function" rel="rdfs-seeAlso">preg_match()</a> - Perform a regular expression match</span></li>
    <li class="member"><span class="function"><a href="function.strcmp.php" class="function" rel="rdfs-seeAlso">strcmp()</a> - Binary safe string comparison</span></li>
    <li class="member"><span class="function"><a href="function.strcasecmp.php" class="function" rel="rdfs-seeAlso">strcasecmp()</a> - Binary safe case-insensitive string comparison</span></li>
    <li class="member"><span class="function"><a href="function.substr.php" class="function" rel="rdfs-seeAlso">substr()</a> - Return part of a string</span></li>
    <li class="member"><span class="function"><a href="function.stristr.php" class="function" rel="rdfs-seeAlso">stristr()</a> - Case-insensitive strstr</span></li>
    <li class="member"><span class="function"><a href="function.strncasecmp.php" class="function" rel="rdfs-seeAlso">strncasecmp()</a> - Binary safe case-insensitive string comparison of the first n characters</span></li>
    <li class="member"><span class="function"><a href="function.strstr.php" class="function" rel="rdfs-seeAlso">strstr()</a> - Find first occurrence of a string</span></li>
   </ul>
  </p>
 </div>


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