function.eregi.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 154 行

HTML
154
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Case insensitive regular expression match</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.eregi-replace.html">eregi_replace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.split.html">split</a></div> <div class="up"><a href="ref.regex.html">POSIX Regex Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.eregi" class="refentry"> <div class="refnamediv">  <h1 class="refname">eregi</h1>  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">eregi</span> &mdash; <span class="dc-title">Case insensitive regular expression match</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">int</span> <span class="methodname"><b><b>eregi</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$pattern</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$string</tt></span>   [, <span class="methodparam"><span class="type">array</span> <tt class="parameter reference">&$regs</tt></span>  ] )</div>  <p class="para rdfs-comment">   This function is identical to <a href="function.ereg.html" class="function">ereg()</a> except that it   ignores case distinction when matching alphabetic characters.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">pattern</tt></i></span>     <dd>      <p class="para">       Case insensitive regular expression.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">string</tt></i></span>     <dd>      <p class="para">       The input string.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">regs</tt></i></span>     <dd>      <p class="para">       If matches are found for parenthesized substrings of       <i><tt class="parameter">pattern</tt></i> and the function is called with the       third argument <i><tt class="parameter">regs</tt></i>, the matches will be stored       in the elements of the array <i><tt class="parameter">regs</tt></i>.       </p>      <p class="para">       $regs[1] will contain the substring which starts at the first left       parenthesis; $regs[2] will contain the substring starting at the       second, and so on. $regs[0] will contain a copy of the complete string       matched.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns the length of the matched string if a match for   <i><tt class="parameter">pattern</tt></i> was found in <i><tt class="parameter">string</tt></i>,   or <b><tt>FALSE</tt></b> if no matches were found or an error occurred.  </p>  <p class="para">   If the optional parameter <i><tt class="parameter">regs</tt></i> was not passed or   the length of the matched string is 0, this function returns 1.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>eregi()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$string&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'XYZ'</span><span style="color: #007700">;<br />if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">'z'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$string</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"'$string'&nbsp;contains&nbsp;a&nbsp;'z'&nbsp;or&nbsp;'Z'!"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.ereg.html" class="function" rel="rdfs-seeAlso">ereg()</a></li>    <li class="member"><a href="function.ereg-replace.html" class="function" rel="rdfs-seeAlso">ereg_replace()</a></li>    <li class="member"><a href="function.eregi-replace.html" class="function" rel="rdfs-seeAlso">eregi_replace()</a></li>    <li class="member"><a href="function.stripos.html" class="function" rel="rdfs-seeAlso">stripos()</a></li>    <li class="member"><a href="function.stristr.html" class="function" rel="rdfs-seeAlso">stristr()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.eregi-replace.html">eregi_replace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.split.html">split</a></div> <div class="up"><a href="ref.regex.html">POSIX Regex Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?