mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
* Fix typo add ref warn.deprecated.feature-8-1-0 * Remove <para> in invalid places * Fix language snippets
150 lines
4.8 KiB
XML
150 lines
4.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 3f1dbc451b313fb1ec8058f24c1beccf55fce316 Maintainer: Marqitos Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<chapter xml:id="mbstring.overload" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<title>
|
|
Función de sobrecarga
|
|
</title>
|
|
|
|
&warn.deprecated.feature-7-2-0.removed-8-0-0;
|
|
|
|
<para>
|
|
Puede resultar difícil lograr que una aplicación PHP existente
|
|
funcione en un entorno multibyte determinado. Esto se debe a que la mayoría
|
|
de las aplicaciones PHP están escritas con funciones de string estándar
|
|
como <function>substr</function>, que es conocida por
|
|
no manejar correctamente los strings codificados en multibyte.
|
|
</para>
|
|
<para>
|
|
mbstring admite la sobrecarga de funciones, lo que permite añadir
|
|
compatibilidad con multibyte a este tipo de aplicaciones sin
|
|
modificar el código, mediante la sobrecarga de las funciones equivalentes para multibyte en
|
|
las funciones de string estándar. Por ejemplo,
|
|
si la sobrecarga de funciones está habilitada,
|
|
se llama a <function>mb_substr</function>
|
|
en lugar de a <function>substr</function>.
|
|
Esta característica facilita la migración de aplicaciones que solo admiten
|
|
codificaciones de un solo byte a un entorno multibyte en muchos casos.
|
|
</para>
|
|
<para>
|
|
Para utilizar la sobrecarga de funciones, establezca
|
|
<literal>mbstring.func_overload</literal>, en el &php.ini;, a
|
|
un valor positivo que represente una combinación de máscaras de bits especificando
|
|
las categorías de funciones a sobrecargar. Debe ser definido
|
|
a 1 para sobrecargar la función <function>mail</function>, 2 para las
|
|
funciones de strings, 4 para las funciones de expresiones regulares. Por ejemplo,
|
|
con el valor 7, todas las funciones anteriores serán
|
|
sobrecargadas. A continuación se muestra la lista de funciones sobrecargadas.
|
|
<table>
|
|
<title>Funciones de reemplazo</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Valor de mbstring.func_overload</entry>
|
|
<entry>Función original</entry>
|
|
<entry>Función de reemplazo</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>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
No se recomienda utilizar la opción de sobrecarga de funciones en
|
|
el contexto por directorio, ya que aún no se ha confirmado que sea
|
|
lo suficientemente estable en un entorno de producción y puede provocar un
|
|
comportamiento indefinido.
|
|
</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
|
|
-->
|