Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 13071

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets the base name of the file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="splfileinfo.getatime.html">SplFileInfo::getATime</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splfileinfo.getctime.html">SplFileInfo::getCTime</a></div>
 <div class="up"><a href="class.splfileinfo.html">SplFileInfo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="splfileinfo.getbasename" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplFileInfo::getBasename</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.2, PHP 7)</p><p class="refpurpose"><span class="refname">SplFileInfo::getBasename</span> &mdash; <span class="dc-title">Gets the base name of the file</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-splfileinfo.getbasename-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>SplFileInfo::getBasename</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$suffix</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   This method returns the base name of the file, directory, or link without
   path info.
  </p>
  <div class="caution"><strong class="caution">Caution</strong>
   <p class="para">
    <span class="function"><strong>SplFileInfo::getBasename()</strong></span> is locale aware, so for it to see the 
    correct basename with multibyte character paths, the matching locale must 
    be set using the <span class="function"><a href="function.setlocale.html" class="function">setlocale()</a></span> function.
   </p>
  </div>
 </div>


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

    
     <dt>
<code class="parameter">suffix</code></dt>

     <dd>

      <p class="para">
       Optional suffix to omit from the base name returned.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileinfo.getbasename-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the base name without path information.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileinfo.getbasename-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4852">
    <p><strong>Example #1 <span class="function"><strong>SplFileInfo::getBasename()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$info&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SplFileInfo</span><span style="color: #007700">(</span><span style="color: #DD0000">'file.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$info</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getBasename</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$info&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SplFileInfo</span><span style="color: #007700">(</span><span style="color: #DD0000">'/path/to/file.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$info</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getBasename</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$info&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SplFileInfo</span><span style="color: #007700">(</span><span style="color: #DD0000">'/path/to/file.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$info</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getBasename</span><span style="color: #007700">(</span><span style="color: #DD0000">'.txt'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
string(8) &quot;file.txt&quot;
string(8) &quot;file.txt&quot;
string(4) &quot;file&quot; 
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileinfo.getbasename-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="splfileinfo.getfilename.html" class="methodname" rel="rdfs-seeAlso">SplFileInfo::getFilename()</a> - Gets the filename</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="splfileinfo.getatime.html">SplFileInfo::getATime</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splfileinfo.getctime.html">SplFileInfo::getCTime</a></div>
 <div class="up"><a href="class.splfileinfo.html">SplFileInfo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>