<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.ltrim.php',
    1 => 'ltrim',
    2 => 'Elimina los espacios (u otros caracteres) del inicio de un string',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'Funciones de strings',
  ),
  'prev' => 
  array (
    0 => 'function.localeconv.php',
    1 => 'localeconv',
  ),
  'next' => 
  array (
    0 => 'function.md5.php',
    1 => 'md5',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/strings/functions/ltrim.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ltrim" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ltrim</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ltrim</span> &mdash; <span class="dc-title">Elimina los espacios (u otros caracteres) del inicio de un string</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ltrim-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ltrim</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$characters</code><span class="initializer"> = &quot; \n\r\t\v\x00&quot;</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Elimina los espacios (u otros caracteres) del inicio de un string.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ltrim-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
    <dt><code class="parameter">string</code></dt>
    <dd>
     <span class="simpara">
      El string de entrada.
     </span>
    </dd>
   
   
    <dt><code class="parameter">characters</code></dt>
    <dd>
     
 <span class="simpara">
 Opcionalmente, los caracteres a eliminar también pueden ser especificados utilizando
 el parámetro <code class="parameter">characters</code>.
 Basta con listar todos los caracteres que deben ser eliminados.
 Con <code class="literal">..</code>, es posible especificar un rango creciente de caracteres.
 </span>
 
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ltrim-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="simpara">
   Esta función devuelve un string con los espacios eliminados al inicio del <code class="parameter">string</code>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ltrim-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo con <span class="function"><strong>ltrim()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$text </span><span style="color: #007700">= </span><span style="color: #DD0000">"\t\tThese are a few words :) ...  "</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$binary </span><span style="color: #007700">= </span><span style="color: #DD0000">"\x09Example string\x0A"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hello  </span><span style="color: #007700">= </span><span style="color: #DD0000">"Hello World"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">, </span><span style="color: #0000BB">$binary</span><span style="color: #007700">, </span><span style="color: #0000BB">$hello</span><span style="color: #007700">);<br /><br />print </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$trimmed </span><span style="color: #007700">= </span><span style="color: #0000BB">ltrim</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$trimmed</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$trimmed </span><span style="color: #007700">= </span><span style="color: #0000BB">ltrim</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">, </span><span style="color: #DD0000">" \t."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$trimmed</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$trimmed </span><span style="color: #007700">= </span><span style="color: #0000BB">ltrim</span><span style="color: #007700">(</span><span style="color: #0000BB">$hello</span><span style="color: #007700">, </span><span style="color: #DD0000">"Hdle"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$trimmed</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Elimina los caracteres de control ASCII del inicio de $binary<br />// (de 0 a 31, inclusive)<br /></span><span style="color: #0000BB">$clean </span><span style="color: #007700">= </span><span style="color: #0000BB">ltrim</span><span style="color: #007700">(</span><span style="color: #0000BB">$binary</span><span style="color: #007700">, </span><span style="color: #DD0000">"\x00..\x1F"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$clean</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>El ejemplo anterior mostrará:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">string(32) &quot;        These are a few words :) ...  &quot;
string(16) &quot;    Example string
&quot;
string(11) &quot;Hello World&quot;

string(30) &quot;These are a few words :) ...  &quot;
string(30) &quot;These are a few words :) ...  &quot;
string(7) &quot;o World&quot;
string(15) &quot;Example string
&quot;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ltrim-seealso">
  <h3 class="title">Ver también</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.trim.php" class="function" rel="rdfs-seeAlso">trim()</a> - Elimina los espacios (u otros caracteres) al inicio y al final de un string</span></li>
   <li><span class="function"><a href="function.rtrim.php" class="function" rel="rdfs-seeAlso">rtrim()</a> - Elimina los espacios (u otros caracteres) al final de un string</span></li>
  </ul>
 </div>


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