mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 16:02:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@326755 c90b9560-bf6c-de11-be94-00142212c4b1
172 lines
5.5 KiB
XML
172 lines
5.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: chuso Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: seros -->
|
|
|
|
<chapter xml:id="mbstring.overload" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<title>
|
|
Sobrecarga de Funciones
|
|
</title>
|
|
<para>
|
|
Quizás resulte complicado obtener una aplicación de PHP que
|
|
funcione en un determinado entorno multibyte. Esto sucede porque la
|
|
mayor parte de las aplicaciones de PHP están escritas con las funciones estándar
|
|
de cadenas de caracteres, como por ejemplo <function>substr</function>, la cual se sabe
|
|
que no maneja correctamente los strings codificados de forma multibyte.
|
|
</para>
|
|
<para>
|
|
mbstring admite la 'sobrecarga de funciones', característica que permite
|
|
que tales aplicaciones consideren los multibyes sin necesidad de modificar
|
|
el código, sobrecargando las funciones homólogas multibyes sobre las
|
|
estándar de cadenas de caracteres. Por ejemplo, se invocaría a
|
|
<function>mb_substr</function> en lugar de a
|
|
<function>substr</function> si se habilitara la sobrecarga de funciones.
|
|
En muchos casos, esta funcionalidad simplifica la portabilidad de las
|
|
aplicaciones que tan solo admiten codificaciones de un único byte a entornos multibyte.
|
|
</para>
|
|
<para>
|
|
Para utilizar la sobrecarga de funciones, se ha de establecer
|
|
<literal>mbstring.func_overload</literal> en &php.ini; a un
|
|
valor positivo que represente una combinación de máscaras de bits que especifiquen
|
|
las categorías de las funciones que se sobrecargarán. Para sobrecargar
|
|
la función <function>mail</function> debe etablecerse a 1. Para funciones
|
|
de string, a 2. Para funciones de expresiones regulares, a 4. Por ejemplo,
|
|
si se estableciera a 7, se sobrecargaría las funciones de mail, de string, y de
|
|
expresiones regulares. A continuación se muestra la lista de funciones sobrecargadas.
|
|
<table>
|
|
<title>Funciones sobrecargadas</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>valor de mbstring.func_overload</entry>
|
|
<entry>función original</entry>
|
|
<entry>función sobrecargada</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry><function>mail</function></entry>
|
|
<entry><function>mb_send_mail</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strlen</function></entry>
|
|
<entry><function>mb_strlen</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strpos</function></entry>
|
|
<entry><function>mb_strpos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strrpos</function></entry>
|
|
<entry><function>mb_strrpos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>substr</function></entry>
|
|
<entry><function>mb_substr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strtolower</function></entry>
|
|
<entry><function>mb_strtolower</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strtoupper</function></entry>
|
|
<entry><function>mb_strtoupper</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>stripos</function></entry>
|
|
<entry><function>mb_stripos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strripos</function></entry>
|
|
<entry><function>mb_strripos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strstr</function></entry>
|
|
<entry><function>mb_strstr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>stristr</function></entry>
|
|
<entry><function>mb_stristr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strrchr</function></entry>
|
|
<entry><function>mb_strrchr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>substr_count</function></entry>
|
|
<entry><function>mb_substr_count</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><function>ereg</function></entry>
|
|
<entry><function>mb_ereg</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><function>eregi</function></entry>
|
|
<entry><function>mb_eregi</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><function>ereg_replace</function></entry>
|
|
<entry><function>mb_ereg_replace</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><function>eregi_replace</function></entry>
|
|
<entry><function>mb_eregi_replace</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><function>split</function></entry>
|
|
<entry><function>mb_split</function></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
No se recomienda habilitar la sobrecarga de funciones en un contexto
|
|
de directorios, ya que todavía no se ha confirmado que su uso sea
|
|
suficientemente estable en un entorno de producción, lo que podría
|
|
conducir a comportamientos inesperados.
|
|
</para>
|
|
</note>
|
|
</chapter>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|