1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.19 $ -->
<reference id="ref.mbstring">
<title>マルチバイト文字列関数(mbstring)</title>
<titleabbrev>
マルチバイト文字列
</titleabbrev>
<partintro>
<sect1 id="mb-intro">
<title>導入</title>
<para>
全ての文字をシングルバイトで表現可能な言語は数多くあります。マル
チバイト文字コードは、多くの言語で文字を表すために使用されていま
す。<literal>mbstring</literal> は日本語文字を処理するために開発
されました。しかし、<literal>mbstring</literal> 関数の多くは、日
本語以外の文字エンコーディングも処理することが可能です。
</para>
<para>
マルチバイト文字エンコーディングは、バイトの並びで単一の文字を表
現します。いくつかの文字エンコーディングでは、マルチバイト文字列
の始まり/終わりを表すためにシフト(エスケープ)シーケンスが使用され
ています。この場合、マルチバイト文字エンコーディングに対応した方
法でない限り、分割または追加されるとマルチバイト文字列は壊れてし
まう可能性があります。このモジュールは、マルチバイト文字列に対応
した文字列関数および変換関数のようなその他のユーティリティ関数を
提供します。
</para>
<para>
PHPは、基本的にISO-8859-1用に設計されているため、いくつかのマルチ
バイト文字エンコーディングは、PHPで正常に動作しません。このため、
<literal>mbstring.internal_encoding</literal> にPHPで動作する文字
エンコーディングを設定することが必要です。
</para>
<para>
PHP4の文字エンコーディングに関する規約
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
バイト毎のエンコーディングである。
</simpara>
</listitem>
<listitem>
<simpara>
シングルバイト文字は、<literal>ASCII</literal>互換の
<literal>00h-7fh</literal>の範囲にある。
</simpara>
</listitem>
<listitem>
<simpara>
マルチバイト文字は、<literal>00h-7fh</literal>以外を使用する。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
PHPの内部エンコーディングとして使用可能な文字エンコーディングと
使用できない文字エンコーディングの例を以下に示します。
<informalexample>
<programlisting>
<![CDATA[
PHPで動作する文字エンコーディング:
ISO-8859-*, EUC-JP, UTF-8
PHPで動作しない文字エンコーディング:
JIS, SJIS
]]>
</programlisting>
</informalexample>
</para>
<para>
PHPの内部エンコーディングとして使用できない文字エンコーディングは、
<literal>mbstring</literal>のHTTP入力/出力変換の機能/関数により変換
することが可能です。
</para>
<note>
<para>
SJIS は、読者がパーサ/コンパイラ、文字エンコーディングと文字エン
コーディングの問題点について精通していない限り内部エンコーディン
グとして使用するべきではありません。
</para>
</note>
<note>
<para>
PHPでデータベースを使用する場合、性能を向上させるためにデータベー
スとPHPの内部エンコーディングについて同じ文字エンコーディングを使用
することを推奨します。
</para>
<para>
PostgreSQLを使用している場合、バックエンドの文字エンコーディング
と異なる文字エンコーディングを使用することが可能です。詳細につい
ては、PostgreSQLのマニュアルを参照下さい。
</para>
</note>
<sect2 id="mb-enable">
<title>mbstringの使用法</title>
<para>
<literal>mbstring</literal> は拡張モジュールです。
<literal>configure</literal>スクリプトでモジュールを有効にする必
要があります。詳細については、<link
linkend="installation">インストール</link>の節を参照下さい。
</para>
<simpara>
以下のconfigureオプションが<literal>mbstring</literal>モジュール
に関係するものです。
</simpara>
<para>
<itemizedlist>
<listitem>
<para>
<option role="configure">--enable-mbstring</option> :
<literal>mbstring</literal> 関数を有効にします。このオプショ
ンは、<literal>mbstring</literal> 関数を利用するために必要で
す。
</para>
</listitem>
<listitem>
<para>
<option role="configure">--enable-mbstr-enc-trans</option> :
<literal>mbstring</literal>変換エンジンを使用したHTTP入力の文
字エンコーディング変換を有効にします。この機能が有効の場合、
HTTP入力文字エンコーディングは、自動的に
<literal>mbstring.internal_encoding</literal>に変換されます。
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="mb-conv">
<title>HTTP入出力</title>
<para>
HTTP 入出力の文字エンコーディング変換はバイナリデータも変換して
しまいます。HTTP入出力にバイナリデータが使用される場合、ユーザは、
文字エンコーディング変換を制御する必要があります。
</para>
<para>
HTMLフォームの<literal>enctype</literal>が
<literal>multipart/form-data</literal>に設定された場合、
<literal>mbstring</literal> は、POSTデータの文字エンコーディング
を変換しません。この場合、文字列を内部文字エンコーディングに変換
してやる必要があります。
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
HTTP入力
</simpara>
<para>
PHPスクリプトでHTTP入力文字変換を制御する手段はありません。
HTTP入力文字変換を無効にするには、<literal>php.ini</literal>
で行う必要があります。
<example>
<title>php.iniでHTTP入力変換を無効にする</title>
<programlisting role="php">
<![CDATA[
;; HTTP入力変換を無効にする
mbstring.http_input = pass
]]>
</programlisting>
</example>
</para>
<para>
PHPをApacheモジュールで使用する場合、php.iniの設定を
<literal>httpd.conf</literal>により仮想ホスト単位で、または
<literal>.htaccess</literal>によりディレクトリ単位で上書きす
ることが可能です。詳細は、<link linkend="configuration">設定
</link>の節およびApacheマニュアルを参照下さい。
</para>
</listitem>
<listitem>
<simpara>
HTTP出力
</simpara>
<para>
出力の文字エンコーディング変換を有効にする方法は複数あります。
一つ目は <literal>php.ini</literal>、もう1つは
<function>ob_start</function> で <literal>ob_start</literal>
のコールバック関数として
<function>mb_output_handler</function> を指定するものです。
</para>
<note>
<para>
PHP3-i18nのユーザにとっては、<literal>mbstring</literal>の出
力変換は、PHP3-i18nとは異なっています。文字エンコーディング
は、出力のバッファリング機能を使用して変換されます。
</para>
</note>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><literal>php.ini</literal>の設定例</title>
<programlisting>
<![CDATA[
;; 全てのPHPページで出力の文字エンコーディング変換を有効にする
;; 出力バッファリングを有効にする
output_buffering = On
;; mb_output_handlerによる出力変換を有効にする
output_handler = mb_output_handler
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>スクリプトの例</title>
<programlisting role="php">
<![CDATA[
<?php
// このページでのみ出力の文字エンコーディング変換を有効にする
// HTTP 出力文字エンコーディングをSJISに設定する
mb_http_output('SJIS');
// 出力のバッファリングを開始し、コールバック関数として"mb_output_handler"
// を指定する
ob_start('mb_output_handler');
?>
]]>
</programlisting>
</example>
</para>
</sect2>
<sect2 id="mb-code">
<title>サポートされる文字エンコーディング</title>
<simpara>
現在、以下の文字エンコーディングが<literal>mbstring</literal>モ
ジュールによりサポートされています。文字エンコーディングは、
<literal>mbstring</literal>関数の<literal>encoding</literal>パラ
メータで指定することが可能です。
</simpara>
<para>
以下の文字エンコーディングがこのPHP拡張モジュールでサポートされ
ています。
</para>
<para>
<literal>UCS-4</literal>, <literal>UCS-4BE</literal>,
<literal>UCS-4LE</literal>, <literal>UCS-2</literal>,
<literal>UCS-2BE</literal>, <literal>UCS-2LE</literal>,
<literal>UTF-32</literal>, <literal>UTF-32BE</literal>,
<literal>UTF-32LE</literal>, <literal>UCS-2LE</literal>,
<literal>UTF-16</literal>, <literal>UTF-16BE</literal>,
<literal>UTF-16LE</literal>, <literal>UTF-8</literal>,
<literal>UTF-7</literal>, <literal>ASCII</literal>,
<literal>EUC-JP</literal>, <literal>SJIS</literal>,
<literal>eucJP-win</literal>, <literal>SJIS-win</literal>,
<literal>ISO-2022-JP</literal>, <literal>JIS</literal>,
<literal>ISO-8859-1</literal>, <literal>ISO-8859-2</literal>,
<literal>ISO-8859-3</literal>, <literal>ISO-8859-4</literal>,
<literal>ISO-8859-5</literal>, <literal>ISO-8859-6</literal>,
<literal>ISO-8859-7</literal>, <literal>ISO-8859-8</literal>,
<literal>ISO-8859-9</literal>, <literal>ISO-8859-10</literal>,
<literal>ISO-8859-13</literal>, <literal>ISO-8859-14</literal>,
<literal>ISO-8859-15</literal>, <literal>byte2be</literal>,
<literal>byte2le</literal>, <literal>byte4be</literal>,
<literal>byte4le</literal>, <literal>BASE64</literal>,
<literal>7bit</literal>, <literal>8bit</literal>,
<literal>UTF7-IMAP</literal>
</para>
<para>
エンコーディング名を指定可能な<literal>php.ini</literal> のエン
トリでは、"<literal>auto</literal>" および
"<literal>pass</literal>" も指定可能です。
<literal>mbstring</literal> 関数には、エンコーディング名と
"<literal>auto</literal>" を指定可能です。
</para>
<para>
"<literal>pass</literal>" が指定された場合、文字エンコー
ディング変換は行われません。
</para>
<para>
"<literal>auto</literal>" が指定された場合、この文字列
は、"<literal>ASCII,JIS,UTF-8,EUC-JP,SJIS</literal>"に
変換されます。
</para>
<para>
<function>mb_detect_order</function>も参照下さい。
</para>
<note>
<para>
"サポートされる文字エンコーディング" は、内部文字コー
ドとして動作するものとは異なります。
</para>
</note>
</sect2>
<sect2 id="mb-ini">
<title>php.iniの設定</title>
<para>
<itemizedlist>
<listitem>
<simpara>
<literal>mbstring.internal_encoding</literal> は内部文字エン
コーディングのデフォルト値を定義します。
</simpara>
</listitem>
<listitem>
<simpara>
<literal>mbstring.http_input</literal> はHTTP入力文字エンコー
ディングのデフォルト値を定義します。
</simpara>
</listitem>
<listitem>
<simpara>
<literal>mbstring.http_output</literal> は、HTTP出力文字エン
コーディングのデフォルト値を定義します。
</simpara>
</listitem>
<listitem>
<simpara>
<literal>mbstring.detect_order</literal> は、文字コード検出の
デフォルト値を定義します。
<function>mb_detect_order</function>も参照下さい。
</simpara>
</listitem>
<listitem>
<simpara>
<literal>mbstring.substitute_character</literal> は、無効な文
字を代替する文字を定義します。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
Webブラウザは、フォームのデータを投稿する際に同じ文字エンコーディ
ングを使用すると仮定されます。しかし、ブラウザは同じ文字エンコー
ディングを使用しない可能性があります。ブラウザで使用される文字エ
ンコーディングを検出するには、<function>mb_http_input</function>
を参照下さい。
</para>
<para>
HTMLフォームで<literal>enctype</literal> が
<literal>multipart/form-data</literal> に設定された場合、
<literal>mbstring</literal>はPOSTデータの文字エンコーディングを
変換しません。ユーザは、変換に応じてスクリプト内で変換を行う必要
があります。
</para>
<para>
しかし、ブラウザ側でもHTML内の文字エンコーディングを検出すること
は可能です。HTMLヘッダで<literal>charset</literal>を設定する方が
より良いでしょう。文字エンコーディングに応じて
<literal>default_charset</literal>を変更して下さい。
</para>
<para>
<example>
<title><literal>php.ini</literal>設定の例</title>
<programlisting>
<![CDATA[
;; デフォルトの内部エンコーディングを設定
;; 注意: PHPで動作する文字エンコーディングを使用すること
mbstring.internal_encoding = UTF-8 ; 内部エンコーディングをUTF-8に設定
;; デフォルトのHTTP入力文字エンコーディングを設定
;; 注意: スクリプトではhttp_inputの設定は変更できません。
mbstring.http_input = pass ; 変換しない。
mbstring.http_input = auto ; HTTP入力をautoに設定
; "auto" は、"ASCII,JIS,UTF-8,
; EUC-JP,SJIS"に展開されます。
mbstring.http_input = SJIS ; HTTP入力をSJISに設定
mbstring.http_input = UTF-8,SJIS,EUC-JP ; 順番を指定
;; デフォルトのHTTP出力文字エンコーディングを設定
mbstring.http_output = pass ; 変換せず
mbstring.http_output = UTF-8 ; HTTP出力エンコーディングをUTF-8に指定
;; デフォルトの文字エンコーディング検出順序を設定
mbstring.detect_order = auto ; デフォルトの順番をautoに設定
mbstring.detect_order = ASCII,JIS,UTF-8,SJIS,EUC-JP ; 順番を指定
;; 代替文字のデフォルト値を設定
mbstring.substitute_character = 12307 ; Unicode値を指定
mbstring.substitute_character = none ; 文字を出力しない
mbstring.substitute_character = long ; longの例: U+3000,JIS+7E7E
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>
<literal>EUC-JP</literal> ユーザ用の<literal>php.ini</literal>
の設定
</title>
<programlisting>
<![CDATA[
;; 出力バッファリングを無効にする
output_buffering = Off
;; HTTP charsetヘッダを設定
default_charset = EUC-JP
;; HTTP 入力エンコーディング変換をautoに設定
mbstring.http_input = auto
;; HTTP出力をEUC-JPに設定
mbstring.http_output = EUC-JP
;; 内部エンコーディングをEUC-JPに設定
mbstring.internal_encoding = EUC-JP
;; 無効な文字を出力しない
mbstring.substitute_character = none
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>
<literal>SJIS</literal>ユーザ用の<literal>php.ini</literal>の
設定
</title>
<programlisting>
<![CDATA[
;; 出力のバッファリングを有効に
output_buffering = On
;; 出力の変換を有効にするために mb_output_handler を設定
output_handler = mb_output_handler
;; HTTPヘッダ charset を設定
default_charset = Shift_JIS
;; HTTP入力エンコーディング変換をautoに設定
mbstring.http_input = auto
;; SJISに変換
mbstring.http_output = SJIS
;; 内部エンコーディングをEUC-JPに設定
mbstring.internal_encoding = EUC-JP
;; 無効な文字を出力しない
mbstring.substitute_character = none
]]>
</programlisting>
</example>
</para>
</sect2>
<sect2 id="mb-overload">
<title>マルチバイト対応版関数による既存関数のオーバーロード</title>
<para>
PHPアプリケーションの多くは、英語等のシングルバイトの言語用に設計
されており、日本語を含むマルチバイト文字列を扱う場合には問題を生
じる場合があります。<function>substr</function>等のPHPの文字列関
数の多くはマルチバイト文字列に対応していません。
</para>
<para>
マルチバイト拡張モジュール(mbstring)では、文字列を処理するPHP関数
のマルチバイト対応版(例えば、<function>substr</function>の場合は
<function>mb_substr</function>)をサポートしています。
</para>
<para>
マルチバイト拡張モジュール(mbstring)では、PHP 4.2.0以降で既存の
PHP関数を対応するマルチバイト文字対応版の関数でオーバーロードする
機能をサポートします。関数のオーバーロードを行うと、例えば
<function>substr</function>をPHPスクリプトでコールした場合に、
<function>mb_substr</function>が代わりにコールされるようになりま
す。これにより、マルチバイト文字に対応しないアプリケーションの移
植が容易となります。
</para>
<para>
関数オーバーロードを使用するには、設定ファイル php.iniの
<literal>mbstring.func_overload</literal>ディレクティブに0以外の
値を設定します。設定値によりオーバーロードされる関数の種類が異な
ります。メール関数の場合は1、文字列関数は2、正規表現関数は4を使用
します。論理和をとることにより複数の値を指定可能です。例えば、7を
指定すると全てのメール、文字列、正規表現関数をオーバーロードしま
す。オーバーロードされる関数を下表に示します。
<table>
<title>オーバーロードされる関数</title>
<tgroup cols="3">
<thead>
<row>
<entry>mbstring.func_overloadの値</entry>
<entry>元の関数</entry>
<entry>オーバーロードする関数</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>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>
</sect2>
<sect2 id="mb-ja-basic">
<title>日本語のマルチバイト文字に関する基本事項</title>
<para>
多くの日本語の文字は1文字あたり複数のバイトを必要とします。加え
て、日本語の環境では複数の文字エンコーディング手法が使用されてい
ます。使用されているのは、EUC-JP、Shift_JIS(SJIS)、
ISO-2022-JP(JIS) 文字エンコーディングです。Unicodeが普及しつつあ
り、UTF-8 も使用されています。日本語環境のWebアプリケーションを
開発するためには、HTTP入出力、RDBMS、e-mailの処理においてそれぞ
れに適した文字集合を使用することが重要となります。
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
1文字は最大6バイトになる
</simpara>
</listitem>
<listitem>
<simpara>
マルチバイト文字は通常シングルバイト文字の2倍の幅となります。
広い幅の文字は「全角」、狭い幅の文字は「半角」と呼ばれます。
通常、「全角」文字は固定幅です。
</simpara>
</listitem>
<listitem>
<simpara>
いくつかの文字エンコーディングでは、マルチバイト文字列を開始/
終了するためのシフト(エスケープ)シーケンスが定義されています。
</simpara>
</listitem>
<listitem>
<simpara>
SMTP/NNTPでは、ISO-2022-JP を使用する必要があります。
</simpara>
</listitem>
<listitem>
<para>
"i-mode" 用Webサイトは、SJISを使用する必要がありま
す。
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="mb-ref">
<title>リファレンス</title>
<para>
マルチバイト文字エンコーディングと関連する問題は非常に複雑です。
ここで詳細について記述することは不可能です。詳細な事項については、
以下のURLおよび他のリソースを参照下さい。
<itemizedlist>
<listitem>
<para>
Unicode/UTF/UCS/等
</para>
<para>
<literal>http://www.unicode.org/</literal>
</para>
</listitem>
<listitem>
<para>
日本語/韓国語/中国語文字に関する情報
</para>
<para>
<literal>
ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/cjk.inf
</literal>
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
</partintro>
<refentry id="function.mb-language">
<refnamediv>
<refname>mb_language</refname>
<refpurpose>
カレントの言語を設定/取得
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_language</methodname>
<methodparam choice="opt"><type>string</type><parameter>language</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_language</function> は言語を設定します。
<parameter>language</parameter> が省略された場合、カレントの言語
を文字列で返します。
</para>
<para>
この<parameter>language</parameter>が、e-mailメッセージのエンコー
ディングとして使用されます。有効な言語は、"Japanese",
"ja","English","en", "uni" (UTF-8) です。
<function>mb_send_mail</function> は、e-mailをエンコードする際に
この設定を使用します。
</para>
<para>
言語とその設定は、Japaneseの場合はISO-2022-JP/Base64、uniの場合は
UTF-8/Base64、Englishの場合はISO-8859-1/quoted printableです。
</para>
<para>
返り値: <parameter>language</parameter> が設定され、
<parameter>language</parameter> が有効な場合、&true;が返されます。
そうでない場合、&false;が返されます。
<parameter>language</parameter> が省略された場合、言語の名前が文
字列として返されます。事前に言語が設定されていない場合、&false;が返
されます。
</para>
<para>
<function>mb_send_mail</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-parse-str">
<refnamediv>
<refname>mb_parse_str</refname>
<refpurpose>
GET/POST/COOKIEデータをパースし、グローバル変数を設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>boolean</type><methodname>mb_parse_str</methodname>
<methodparam><type>string</type><parameter>encoded_string</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_parse_str</function> は、GET/POST/COOKIE データをパー
スし、グローバル変数を設定します。PHPは、生のPOST/COOKIEを提供し
ないため、現状ではGETデータでのみ使用可能です。この関数は、URLエ
ンコードされたデータをパース、エンコーディングを検出、内部エンコー
ディングへ変換し、配列<parameter>result</parameter>またはグローバ
ル配列に設定します。
</para>
<para>
<parameter>encoded_string</parameter>: URLエンコードされたデータ。
</para>
<para>
<parameter>result</parameter>: デコードされ、文字エンコーディング
変換された文字列が含まれます。
</para>
<para>
返り値: 成功時に&true;、失敗した場合に&false;。
</para>
<para>
<function>mb_detect_order</function>,
<function>mb_internal_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-internal-encoding">
<refnamediv>
<refname>mb_internal_encoding</refname>
<refpurpose>
内部文字エンコーディングの設定/取得
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_internal_encoding</methodname>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_internal_encoding</function>は、内部文字エンコーディ
ングを<parameter>encoding</parameter>に設定します。パラメータが省
略された場合、カレントの内部エンコーディングを返します。
</para>
<para>
<parameter>encoding</parameter>は、HTTP入力文字エンコーディング変
換、HTTP出力文字エンコーディング変換およびmbstringモジュールによ
り定義された文字列関数においてデフォルトの文字エンコーディングと
して使用されます。
</para>
<para>
<parameter>encoding</parameter>: 文字エンコーディング名
</para>
<para>
返り値: <parameter>encoding</parameter>が設定された場合、
<function>mb_internal_encoding</function> は成功時に
&true;、そうでない場合に&false;
を返します。<parameter>encoding</parameter>が省略された場合、カレ
ントの文字エンコーディング名を返します。
</para>
<para>
<example>
<title><function>mb_internal_encoding</function>の例</title>
<programlisting role="php">
<![CDATA[
/* 内部文字エンコーディングをUTF-8に設定 */
mb_internal_encoding("UTF-8");
/* カレントの内部文字エンコーディングを表示 */
echo mb_internal_encoding();
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_http_input</function>,
<function>mb_http_output</function>,
<function>mb_detect_order</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-http-input">
<refnamediv>
<refname>mb_http_input</refname>
<refpurpose>HTTP入力文字エンコーディングの検出</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_http_input</methodname>
<methodparam choice="opt"><type>string</type><parameter>type</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>mb_http_input</function>は、HTTP入力文字エンコーディン
グを検出した結果を返します。
</simpara>
<para>
<parameter>type</parameter>: HTTP入力の型を表す文字列を入力して下
さい。GETの場合は "G"、POSTの場合は "P"、
COOKIEの場合は "C"。<parameter>type</parameter>が省略さ
れた場合、直近に処理された入力型が返されます。
</para>
<para>
返り値: 文字エンコーディング名。
<function>mb_http_input</function>が指定したHTTP入力の処理を行っ
ていない場合、&false;が返されます。
</para>
<para>
<function>mb_internal_encoding</function>,
<function>mb_http_output</function>,
<function>mb_detect_order</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-http-output">
<refnamediv>
<refname>mb_http_output</refname>
<refpurpose>HTTP出力文字エンコーディングの設定/取得</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_http_output</methodname>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<parameter>encoding</parameter> が設定された場合、
<function>mb_http_output</function> は HTTP出力文字エンコーディン
グを<parameter>encoding</parameter>に設定します。この関数を実行し
た後、出力は<parameter>encoding</parameter>に変換されます。
<function>mb_http_output</function>は成功時に
&true;、失敗時に&false;を返しま
す。
</para>
<para>
<parameter>encoding</parameter>が省略された場合、
<function>mb_http_output</function>はカレントのHTTP出力文字エンコー
ディングを返します。
</para>
<para>
<function>mb_internal_encoding</function>,
<function>mb_http_input</function>,
<function>mb_detect_order</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-detect-order">
<refnamediv>
<refname>mb_detect_order</refname>
<refpurpose>
文字エンコーディング検出順序の設定/取得
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_detect_order</methodname>
<methodparam choice="opt"><type>mixed</type><parameter>encoding-list</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_detect_order</function>は、自動文字エンコーディング
検出の順番を<parameter>encoding-list</parameter>に設定します。
成功時に&true;、失敗時に
&false;を返します。
</para>
<para>
<parameter>encoding-list</parameter>は配列またはカンマ区切りの文
字エンコーディングのリストです。("auto" は、
"ASCII, JIS, UTF-8, EUC-JP, SJIS"に展開されます。)
</para>
<para>
<parameter>encoding-list</parameter> が省略された場合、カレントの
文字エンコーディング検出順が配列で返されます。
</para>
<para>
この設定は、<function>mb_detect_encoding</function> および
<function>mb_send_mail</function>に影響します。
</para>
<note>
<para>
<literal>mbstring</literal> は現在次のエンコーディングを検出する
フィルタを実装しています。以下のエンコーディングに無効なバイトシー
ケンスがあった場合、エンコーディング検出は失敗します。
</para>
<simpara>
<literal>UTF-8</literal>, <literal>UTF-7</literal>,
<literal>ASCII</literal>,
<literal>EUC-JP</literal>,<literal>SJIS</literal>,
<literal>eucJP-win</literal>, <literal>SJIS-win</literal>,
<literal>JIS</literal>, <literal>ISO-2022-JP</literal>
</simpara>
<para>
<literal>ISO-8859-*</literal>の場合、<literal>mbstring</literal>
は常に<literal>ISO-8859-*</literal>として検出します。
</para>
<para>
<literal>UTF-16</literal>, <literal>UTF-32</literal>,
<literal>UCS2</literal>,<literal>UCS4</literal>の場合、エンコー
ディング検出は常に失敗します。
</para>
<para>
<example>
<title>無意味な順番の例</title>
<programlisting>
; 常にISO-8859-1として検出される
detect_order = ISO-8859-1, UTF-8
; ASCII/UTF-7の値はUTF-8として有効なため、常にUTF-8として検出される。
detect_order = UTF-8, ASCII, UTF-7
</programlisting>
</example>
</para>
</note>
<para>
<example>
<title><function>mb_detect_order</function>の例</title>
<programlisting role="php">
<![CDATA[
/* リストで検出順を設定 */
mb_detect_order("eucjp-win,sjis-win,UTF-8");
/* 配列で検出順を設定 */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
mb_detect_order($ary);
/* カレントの検出順を表示 */
echo implode(", ", mb_detect_order());
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_internal_encoding</function>,
<function>mb_http_input</function>,
<function>mb_http_output</function>,
<function>mb_send_mail</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-substitute-character">
<refnamediv>
<refname>mb_substitute_character</refname>
<refpurpose>置換文字の設定/入手</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>mixed</type><methodname>mb_substitute_character</methodname>
<methodparam choice="opt"><type>mixed</type><parameter>substrchar</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_substitute_character</function> は、入力文字エンコー
ディングが無効または出力文字エンコーディングに文字コードが存在し
ない場合の代替文字を指定します。無効な文字は、ヌル(出力しない)、
文字列または整数値(Unicode文字コード値)に置換することが可能です。
</para>
<para>
この設定は、<function>mb_detect_encoding</function>および
<function>mb_send_mail</function>に影響します。
</para>
<para>
<parameter>substchar</parameter> : Unicode値の整数または文字列を
以下のように指定します。
<itemizedlist>
<listitem>
<simpara>
"none" : 出力しない
</simpara>
</listitem>
<listitem>
<simpara>
"long" : 出力する文字コード値 (例: U+3000,JIS+7E7E)
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
返り値: <parameter>substchar</parameter> が設定された場合、成功時
に &true;、そうでない場合に
&false;が返されます。
<parameter>substchar</parameter>が設定されない場合、Unicode値また
は
"<literal>none</literal>"/"<literal>long</literal>"
が返されます。
</para>
<para>
<example>
<title><function>mb_substitute_character</function> の例</title>
<programlisting role="php">
<![CDATA[
/* Unicode U+3013 (ゲタ記号)を設定 */
mb_substitute_character(0x3013);
/* HEXフォーマットを設定 */
mb_substitute_character("long");
/* カレントの設定を表示 */
echo mb_substitute_character();
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.mb-output-handler">
<refnamediv>
<refname>mb_output_handler</refname>
<refpurpose>
出力バッファ内で文字エンコーディングを変換するコールバック関数
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_output_handler</methodname>
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
<methodparam><type>int</type><parameter>status</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_output_handler</function> は、
<function>ob_start</function> のコールバック関数です。
<function>mb_output_handler</function> は、出力バッファの文字を内
部文字エンコーディングからHTTP出力文字エンコーディングに変換しま
す。
</para>
<para>
4.1.0以降のバージョンでは、以下の条件が満たされた場合にこのハン
ドラはcharset HTTP ヘッダを設定します。
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
header()で<literal>Content-Type</literal>が設定されていない場
合
</simpara>
</listitem>
<listitem>
<simpara>
デフォルトのMIME型が<literal>text/</literal>で始まる
</simpara>
</listitem>
<listitem>
<simpara>
<literal>http_output</literal> の設定がpass以外
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<parameter>contents</parameter> : 出力バッファの内容
</para>
<para>
<parameter>status</parameter> : 出力バッファのステータス
</para>
<para>
返り値: 変換後の文字列
</para>
<para>
<example>
<title><function>mb_output_handler</function>の例</title>
<programlisting role="php">
<![CDATA[
mb_http_output("UTF-8");
ob_start("mb_output_handler");
]]>
</programlisting>
</example>
</para>
<note>
<para>
イメージのようなバイナリデータをPHPスクリプトから出力したい場合、
<function>mb_http_output</function>を用いて出力エンコーディング
を"pass"にし、変換を無効とする必要があります。
</para>
</note>
<para>
<function>ob_start</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-preferred-mime-name">
<refnamediv>
<refname>mb_preferred_mime_name</refname>
<refpurpose>MIME文字設定を文字列で得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_preferred_mime_name</methodname>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_preferred_mime_name</function> は、文字エンコーディ
ング<parameter>encoding</parameter>用の
MIME<literal>charset</literal>文字列を返します。
<literal>charset</literal>用の文字列が返されます。
</para>
<para>
<example>
<title><function>mb_preferred_mime_string</function>の例</title>
<programlisting role="php">
<![CDATA[
$outputenc = "sjis-win";
mb_http_output($outputenc);
ob_start("mb_output_handler");
Header("Content-Type: text/html; charset=" . mb_preferred_mime_name($outputenc));
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strlen">
<refnamediv>
<refname>mb_strlen</refname>
<refpurpose>文字列の長さを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_strlen</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strlen</function> は、文字エンコーディング
<parameter>encoding</parameter>の文字列<parameter>str</parameter>
の文字数を返します。マルチバイト文字の一文字は1個として数えられま
す。
</para>
<para>
<parameter>encoding</parameter> は、<parameter>str</parameter>用
の文字エンコーディングです。<parameter>encoding</parameter> が省
略された場合、内部文字エンコーディングが使用されます。
</para>
<para>
<function>mb_internal_encoding</function>,
<function>strlen</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strpos">
<refnamediv>
<refname>mb_strpos</refname>
<refpurpose>
文字列の中に指定した文字列が最初に現れる位置を見つける
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>mb_strpos</methodname>
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strpos</function> は、文字列
<parameter>haystack</parameter>の中で
<parameter>needle</parameter>が最初に現れる位置を返します。
<parameter>needle</parameter> が見付からなかった場合、&false;を返し
ます。
</para>
<para>
<function>mb_strpos</function> にマルチバイト対応版の
<function>strpos</function> 処理を文字数に基づき行います。
位置 <parameter>needle</parameter> は、
<parameter>haystack</parameter>の始めから数えられます。最初の文字
の位置は0、2番目の文字の位置は1、といったようになります。
</para>
<para>
<parameter>encoding</parameter> が省略された場合、内部文字エンコー
ディングが使用されます。<function>strpos</function> が英字のみを
受けつけるのに対して、<function>mb_strpos</function> は、
<parameter>needle</parameter> に <literal>string</literal>を指定
可能です。
</para>
<para>
<parameter>offset</parameter> は検索オフセットです。指定されない
場合は、0 が使用されます。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディング名です。省
略された場合は、内部文字エンコーディングが使用されます。
</para>
<para>
<function>mb_strpos</function>,
<function>mb_internal_encoding</function>,
<function>strpos</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strrpos">
<refnamediv>
<refname>mb_strrpos</refname>
<refpurpose>
文字列の中に指定した文字列が最後に現れる位置を見つける
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>mb_strrpos</methodname>
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strrpos</function> は、文字列
<parameter>haystack</parameter>の中で
<parameter>needle</parameter>が最後に現れる位置を返します。
<parameter>needle</parameter> が見付からなかった場合、&false;を返し
ます。
</para>
<para>
<function>mb_strrpos</function> にマルチバイト対応版の
<function>strrpos</function> 処理を文字数に基づき行います。
位置 <parameter>needle</parameter> は、
<parameter>haystack</parameter>の始めから数えられます。最初の文字
の位置は0、2番目の文字の位置は1、といったようになります。
</para>
<para>
<parameter>encoding</parameter> が省略された場合、内部文字エンコー
ディングが使用されます。<function>strrpos</function> が英字のみを
受けつけるのに対して、<function>mb_strrpos</function> は、
<parameter>needle</parameter> に <literal>string</literal>を指定
可能です。
</para>
<para>
<parameter>offset</parameter> は検索オフセットです。指定されない
場合は、0 が使用されます。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディング名です。省
略された場合は、内部文字エンコーディングが使用されます。
</para>
<para>
<function>mb_strpos</function>,
<function>mb_internal_encoding</function>,
<function>strrpos</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-substr">
<refnamediv>
<refname>mb_substr</refname>
<refpurpose>文字列の一部を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_substr</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>int</type><parameter>start</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_substr</function> は、<parameter>start</parameter>お
よび <parameter>length</parameter> パラメータで指定した
<parameter>str</parameter>の一部を返します。
</para>
<para>
<function>mb_substr</function> は文字数に基づきマルチバイト対応の
<function>substr</function>処理を行います。位置は、
<parameter>str</parameter>の始めから数えられます。最初の文字
の位置は0、2番目の文字の位置は1、といったようになります。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディング名です。省
略された場合は、内部文字エンコーディングが使用されます。
</para>
<para>
<function>mb_strcut</function>,
<function>mb_internal_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strcut">
<refnamediv>
<refname>mb_strcut</refname>
<refpurpose>文字列の一部を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_strcut</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>int</type><parameter>start</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strcut</function> は、
<parameter>start</parameter> および
<parameter>length</parameter> パラメータで指定した
<parameter>str</parameter> の一部を返します。
</para>
<para>
<function>mb_strcut</function> は、<function>mb_substr</function>
と同じ処理を異なった方法で行います。位置
<parameter>start</parameter> がマルチバイト文字の2バイト目以降で
ある場合、マルチバイト文字の最初のバイトから開始されます。
</para>
<para>
この関数は、<parameter>length</parameter>より短く、かつマルチバイ
ト文字列の一部でないかシフトシーケンスの中にない文字を取りだしま
す。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディング名です。省
略された場合は、内部文字エンコーディングが使用されます。
</para>
<para>
<function>mb_substr</function>,
<function>mb_internal_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strwidth">
<refnamediv>
<refname>mb_strwidth</refname>
<refpurpose>文字列の幅を返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>mb_strwidth</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strwidth</function> は文字列
<parameter>str</parameter>の幅を返します。
</para>
<para>
マルチバイト文字は通常シングルバイト文字の倍の幅となります。
</para>
<para>
<informalexample>
<programlisting>
<![CDATA[
文字幅
U+0000 - U+0019 0
U+0020 - U+1FFF 1
U+2000 - U+FF60 2
U+FF61 - U+FF9F 1
U+FFA0 - 2
]]>
</programlisting>
</informalexample>
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディングであり、省
略された場合は内部エンコーディングが使用されます。
</para>
<para>
<function>mb_strimwidth</function>,
<function>mb_internal_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-strimwidth">
<refnamediv>
<refname>mb_strimwidth</refname>
<refpurpose>指定した幅で文字列を丸める</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_strimwidth</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>int</type><parameter>start</parameter></methodparam>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
<methodparam><type>string</type><parameter>trimmarker</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_strimwidth</function> は、文字列
<parameter>str</parameter>を指定した幅
<parameter>width</parameter>で丸めます。この関数は、丸められた文
字列を返します。
</para>
<para>
<parameter>trimmarker</parameter> が設定された場合、
<parameter>trimmarker</parameter> が丸められた文字列に追加されま
す。
</para>
<para>
<parameter>start</parameter> は開始位置のオフセットであり、文字列
の始めからの文字数です。(最初の文字は0)
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディングであり、省
略された場合は内部エンコーディングが使用されます。
</para>
<para>
<example>
<title><function>mb_strimwidth</function> の例</title>
<programlisting role="php">
<![CDATA[
$str = mb_strimwidth($str, 0, 40, "..>");
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_strwidth</function>,
<function>mb_internal_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-convert-encoding">
<refnamediv>
<refname>mb_convert_encoding</refname>
<refpurpose>文字エンコーディングを変換する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_convert_encoding</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>to-encoding</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>from-encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_convert_encoding</function> は、文字列
<parameter>str</parameter>の文字エンコーディングを
<parameter>from-encoding</parameter> から
<parameter>to-encoding</parameter> に変換します。
</para>
<para>
<parameter>str</parameter> : 変換する文字列。
</para>
<para>
<parameter>from-encoding</parameter> により変換前の文字エンコーディ
ング名が指定されます。これは、配列またはカンマ区切りの文字列とす
ることが可能です。
</para>
<para>
<example>
<title><function>mb_convert_encoding</function>の例</title>
<programlisting role="php">
<![CDATA[
/* 内部文字エンコーディングからSJISに変換 */
$str = mb_convert_encoding($str, "SJIS");
/* EUC-JPからUTF-7に変換 */
$str = mb_convert_encoding($str, "UTF-7", "EUC-JP");
/* JIS, eucjp-win, sjis-winの順番で自動検出し、UCS-2LEに変換 */
$str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");
/* "auto" は、"ASCII,JIS,UTF-8,EUC-JP,SJIS" に展開される */
$str = mb_convert_encoding($str, "EUC-JP", "auto");
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_detect_order</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-detect-encoding">
<refnamediv>
<refname>mb_detect_encoding</refname>
<refpurpose>文字エンコーディングを検出する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_detect_encoding</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>encoding-list</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_detect_encoding</function> は、文字列
<parameter>str</parameter>の文字エンコーディングを検出し、検出し
た文字エンコーディングを返します。
</para>
<para>
<parameter>encoding-list</parameter> は文字エンコーディングのリス
トで、エンコーディング検出の順番を配列またはカンマ区切りのリスト
で指定します。
</para>
<para>
<parameter>encoding_list</parameter> が省略された場合、
detect_order が使用されます。
</para>
<para>
<example>
<title><function>mb_detect_encoding</function> の例</title>
<programlisting role="php">
<![CDATA[
/* カレントのdetect_orderで文字エンコーディングを検出 */
echo mb_detect_encoding($str);
/* "auto" は "ASCII,JIS,UTF-8,EUC-JP,SJIS"に展開されます */
echo mb_detect_encoding($str, "auto");
/* カンマ区切りのリストで encoding_list 文字エンコーディングを指定 */
echo mb_detect_encoding($str, "JIS, eucjp-win, sjis-win");
/* encoding_list を指定するために配列を使用 */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
echo mb_detect_encoding($str, $ary);
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_detect_order</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-convert-kana">
<refnamediv>
<refname>mb_convert_kana</refname>
<refpurpose>
カナを("全角かな"、"半角かな"等に)変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_convert_kana</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>option</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_convert_kana</function>は、文字列
<parameter>str</parameter>に関して「半角」-「全角」変換を行い、変
換された文字列を返します。この関数は、日本語のみで使用可能です。
</para>
<para>
<parameter>option</parameter> は変換オプションです。デフォルト値
は、<literal>"KV"</literal>です。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディングで、省略さ
れた場合は内部文字エンコーディングが使用されます。
</para>
<para>
<informalexample>
<programlisting>
<![CDATA[
使用可能な変換オプション
オプション : 以下のオプションを変換時に指定します。デフォルトは
"KV"です。
"r" : 「全角」英字を「半角」に変換
"R" : 「半角」英字を「全角」に変換
"n" : 「全角」数字を「半角」に変換
"N" : 「半角」数字を「全角」に変換
"a" : 「全角」英数字を「半角」に変換
"A" : 「半角」英数字を「全角」に変換
("a", "A" オプションに含まれる文字は、U+0022, U+0027, U+005C,
U+007Eを除く U+0021 - U+007E の範囲です)
"s" : 「全角」スペースを「半角」に変換 (U+3000 -> U+0020)
"S" : 「半角」スペースを「全角」に変換 (U+0020 -> U+3000)
"k" : 「全角片仮名」を「半角片仮名」に変換
"K" : 「半角片仮名」を「全角片仮名」に変換
"h" : 「全角ひら仮名」を「半角片仮名」に変換
"H" : 「半角片仮名」を「全角ひら仮名」に変換
"c" : 「全角かた仮名」を「全角ひら仮名」に変換
"C" : 「全角ひら仮名」を「全角かた仮名」に変換
"V" : 濁点付きの文字を一文字に変換。"K","H"と共に使用します。
]]>
</programlisting>
</informalexample>
</para>
<para>
<example>
<title><function>mb_convert_kana</function> の例</title>
<programlisting role="php">
<![CDATA[
/* 「仮名」を全て「全角カタカナ」に変換します */
$str = mb_convert_kana($str, "KVC");
/* 「半角カタカナ」を「全角カタカナ」に変換し、「全角」英数字を「半角」
に変換します。 */
$str = mb_convert_kana($str, "KVa");
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.mb-encode-mimeheader">
<refnamediv>
<refname>mb_encode_mimeheader</refname>
<refpurpose>MIMEヘッダの文字列をエンコードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_encode_mimeheader</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>charset</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>transfer-encoding</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>linefeed</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_encode_mimeheader</function> は、文字列
<parameter>str</parameter> をヘッダフィールド用のエンコードに変換
します。この関数は、ASCIIエンコーディングされた文字列を返します。
</para>
<para>
<parameter>charset</parameter> は文字エンコーディング名です。デフォ
ルトは、<literal>ISO-2022-JP</literal>です。
</para>
<para>
<parameter>transfer-encoding</parameter> は、transfer encoding で
あり、 <literal>"B"</literal> (Base64) または
<literal>"Q"</literal> (Quoted-Printable)のどちらかとする必要があ
ります。デフォルトは、<literal>"B"</literal>です。
</para>
<para>
<parameter>linefeed</parameter> は行末のマーカです。デフォルトは、
<literal>"\r\n"</literal> (CRLF)です。
</para>
<para>
<example>
<title><function>mb_convert_kana</function> の例</title>
<programlisting role="php">
<![CDATA[
$name = "太郎"; // 漢字
$mbox = "kru";
$doma = "gtinn.mon";
$addr = mb_encode_mimeheader($name, "UTF-7", "Q") . " <" . $mbox . "@" . $doma . ">";
echo $addr;
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_decode_mimeheader</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-decode-mimeheader">
<refnamediv>
<refname>mb_decode_mimeheader</refname>
<refpurpose>MIMEヘッダフィールドの文字列をデコードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_decode_mimeheader</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_decode_mimeheader</function> は、エンコードされた
MIMEヘッダの文字列<parameter>str</parameter>をデコードします。
</para>
<para>
この関数は、内部文字エンコーディングでデコードされた文字列を返し
ます。
</para>
<para>
<function>mb_encode_mimeheader</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-convert-variables">
<refnamediv>
<refname>mb_convert_variables</refname>
<refpurpose>変数の文字コードを変換する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_convert_variables</methodname>
<methodparam><type>string</type><parameter>to-encoding</parameter></methodparam>
<methodparam><type>mixed</type><parameter>from-encoding</parameter></methodparam>
<methodparam><type>mixed</type><parameter>vars</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_convert_variables</function> は、エンコーディング
<parameter>from-encoding</parameter>の変数
<parameter>vars</parameter>をエンコーディング
<parameter>to-encoding</parameter>に変換します。成功時に変換前の
文字エンコーディングを返し、失敗した場合に&false;を返します。
</para>
<para>
<function>mb_convert_variables</function> は、エンコーディング検
出のためにArrayまたはObjectの文字列を結合します。これは、エンコー
ディング検出は短い文字列では失敗する傾向があるためです。このため、
1つの配列またはオブジェクトにエンコーディングを混ぜることはできま
せん。
</para>
<para>
<parameter>from-encoding</parameter> に配列またはカンマ区切り
の文字列が指定された場合、<parameter>from-coding</parameter>から
エンコーディングの検出を試みます。<parameter>encoding</parameter>
が省略された場合、<literal>detect_order</literal> が使用されます。
</para>
<para>
<parameter>vars</parameter>(3番目以降の引数)は、変換する変数への
リファレンスです。文字列、配列、オブジェクトを指定することが可能
です。<function>mb_convert_variables</function> は全てのパラメー
タが同じエンコーディングを有することを仮定します。
</para>
<para>
<example>
<title><function>mb_convert_variables</function> の例</title>
<programlisting role="php">
<![CDATA[
/* 変数 $post1, $post2 を内部エンコーディングに変換する */
$interenc = mb_internal_encoding();
$inputenc = mb_convert_variables($interenc, "ASCII,UTF-8,SJIS-win", $post1, $post2);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.mb-encode-numericentity">
<refnamediv>
<refname>mb_encode_numericentity</refname>
<refpurpose>
文字をHTML数値エンティティにエンコードする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_encode_numericentity</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>array</type><parameter>convmap</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_encode_numericentity</function> は、
<parameter>str</parameter>の中で指定した文字コードをHTML数値エン
ティティから文字コードに変換します。この関数は変換後の文字列を返
します。
</para>
<para>
<parameter>array</parameter> は、変換するコード領域を指定する配列
です。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディングです。
</para>
<para>
<example>
<title><parameter>convmap</parameter> の例</title>
<programlisting role="php">
<![CDATA[
$convmap = array (
int start_code1, int end_code1, int offset1, int mask1,
int start_code2, int end_code2, int offset2, int mask2,
........
int start_codeN, int end_codeN, int offsetN, int maskN );
// start_codeN および end_codeN に Unicode値を指定
// 値にoffsetNを追加、マスクmaskNを指定してビット毎の'AND'をとり、
// 数値エンティティに値を変換します。
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>
<function>mb_encode_numericentity</function> の例
</title>
<programlisting role="php">
<![CDATA[
/* ISO-8859-1の左面をHTML数値エンティティに変換 */
$convmap = array(0x80, 0xff, 0, 0xff);
$str = mb_encode_numericentity($str, $convmap, "ISO-8859-1");
/* ブロック 95-104 にあるSJIS-winコードのユーザ定義領域を数値エンティ
ティに変換 */
$convmap = array(
0xe000, 0xe03e, 0x1040, 0xffff,
0xe03f, 0xe0bb, 0x1041, 0xffff,
0xe0bc, 0xe0fa, 0x1084, 0xffff,
0xe0fb, 0xe177, 0x1085, 0xffff,
0xe178, 0xe1b6, 0x10c8, 0xffff,
0xe1b7, 0xe233, 0x10c9, 0xffff,
0xe234, 0xe272, 0x110c, 0xffff,
0xe273, 0xe2ef, 0x110d, 0xffff,
0xe2f0, 0xe32e, 0x1150, 0xffff,
0xe32f, 0xe3ab, 0x1151, 0xffff );
$str = mb_encode_numericentity($str, $convmap, "sjis-win");
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_decode_numericentity</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb_decode_numericentity">
<refnamediv>
<refname>mb_decode_numericentity</refname>
<refpurpose>
HTML数値エンティティを文字にデコードする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_decode_numericentity</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>array</type><parameter>convmap</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
文字列<parameter>str</parameter>において指定した文字領域にある数
値エンティティを変換し、変換後の文字列を返します。
</para>
<para>
<parameter>array</parameter> は変換するコード領域を指定する配列で
す。
</para>
<para>
<parameter>encoding</parameter> は文字エンコーディングで、省略さ
れた場合は内部文字エンコーディングが使用されます。
</para>
<para>
<example>
<title><parameter>convmap</parameter> の例</title>
<programlisting role="php">
<![CDATA[
$convmap = array (
int start_code1, int end_code1, int offset1, int mask1,
int start_code2, int end_code2, int offset2, int mask2,
........
int start_codeN, int end_codeN, int offsetN, int maskN );
// start_codeN および end_codeN に Unicode値を指定
// 値にoffsetNを追加、マスクmaskNを指定してビット毎の'AND'をとり、
// 数値エンティティに値を変換します。
]]>
</programlisting>
</example>
</para>
<para>
<function>mb_encode_numericentity</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-send-mail">
<refnamediv>
<refname>mb_send_mail</refname>
<refpurpose>
エンコード変換を行ってメールを送信する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>boolean</type><methodname>mb_send_mail</methodname>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
<methodparam><type>string</type><parameter>subject</parameter></methodparam>
<methodparam><type>string</type><parameter>message</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>additional_headers</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>additional_parameter</parameter></methodparam>
</methodsynopsis>
<para>
<function>mb_send_mail</function> は、emailを送信します。ヘッダと
メッセージは<function>mb_language</function>の設定に基づき変換、
エンコードされます。<function>mb_send_mail</function> は、
<function>mail</function>のラッパー関数です。詳細は、
<function>mail</function> を参照下さい。
</para>
<para>
<parameter>to</parameter> は送信先のメールアドレスです。各アドレ
スをカンマで区切ることにより複数の宛先を指定可能です。
</para>
<para>
<parameter>subject</parameter> はメールの題名です。
</para>
<para>
<parameter>message</parameter> はメールのメッセージです。
</para>
<para>
<parameter>additional_headers</parameter> は、ヘッダの最後に挿入
されます。これは、通常、ヘッダを追加する際に使用されます。
改行(\n)で区切ることにより複数のヘッダを指定可能です。
</para>
<para>
<parameter>additional_parameter</parameter> は、MTA のコマンドラ
インパラメータです。sendmailを使用する場合に正しいReturn-Pathを設
定する場合に便利です。
</para>
<para>
成功時に&true;、その他の場合
&false;を返します。
</para>
<para>
<function>mb_language</function>,
<function>mail</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-get-info">
<refnamediv>
<refname>mb_get_info</refname>
<refpurpose>mbstringの内部設定値を取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_get_info</methodname>
<methodparam choice="opt"><type>string</type><parameter>type</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_get_info</function>は、mbstringの内部設定パラメータ
を返します。
</simpara>
<para>
<parameter>type</parameter>が指定されない場合または"all"が指定され
た場合、"internal_encoding", "http_output", "http_input",
"func_overload" の設定値を有する連想配列が返されます。
</para>
<para>
<parameter>type</parameter>に "http_output",
"http_input", "internal_encoding", "func_overload"が指定された場合、
指定された設定パラメータが返されます。
</para>
<para>
<function>mb_internal_encoding</function>,
<function>mb_http_output</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-regex-encoding">
<refnamediv>
<refname>mb_regex_encoding</refname>
<refpurpose>
カレントの正規表現用のエンコーディングを文字列として返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_regex_encoding</methodname>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_regex_encoding</function>は、マルチバイト対応の正規表
現関数で使用される文字エンコーディングを返します。
を返します。
</simpara>
<para>
オプションのパラメータ<parameter>encoding</parameter>が指定された
場合、マルチバイト正規表現用の文字エンコーディングとして設定されま
す。デフォルトは、内部文字エンコーディングです。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_internal_encoding</function>,
<function>mb_ereg</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg">
<refnamediv>
<refname>mb_ereg</refname>
<refpurpose>マルチバイト文字列に正規表現マッチを行う</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>mb_ereg</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg</function>は、マルチバイト対応の正規表現マッチを
行い、一致した場合は1を返します。オプションの3番目の引数
<parameter>regs</parameter>を指定した場合は、一致した部分のバイト
数を返し、配列<parameter>regs</parameter>に一致した部分文字列が格
納されます。空文字に一致した場合は1が返されます。
正規表現に一致しないか、エラーを発生した場合に&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_eregi</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-eregi">
<refnamediv>
<refname>mb_eregi</refname>
<refpurpose>
マルチバイト文字列に大文字小文字を区別しない正規表現マッチを行う
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>mb_eregi</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_eregi</function>は、マルチバイト対応の大文字小文字を
区別しない正規表現マッチを行い、一致した場合は1を返します。オプショ
ンの3番目の引数<parameter>regs</parameter>を指定した場合は、一致し
た部分のバイト数を返し、配列<parameter>regs</parameter>に一致した
部分文字列が格納されます。空文字に一致した場合は1が返されます。
正規表現に一致しないか、エラーを発生した場合に&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-replace">
<refnamediv>
<refname>mb_ereg_replace</refname>
<refpurpose>マルチバイト文字列に正規表現による置換を行う</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_ereg_replace</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>replacement</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>option</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_replace</function>は、マルチバイト文字列
<parameter>string</parameter>において、正規表現
<parameter>pattern</parameter>にマッチする文字列を
<parameter>replacement</parameter>に置換し、置換後の文字列を返しま
す。エラーの場合は、&false;を返します。
</simpara>
<simpara>
オプションの引数<parameter>option</parameter>により、マッチングの
動作を変更可能です。
<literal>i</literal>を指定した場合、大文字、
小文字が区別されなくなります。
<literal>x</literal>を指定した場合、空白が無視されます。
<literal>m</literal>を指定した場合、マルチラインモードとなり、改行
文字も"."に含まれるようになります。
<literal>p</literal>を指定した場合、POSIXモードとなり、改行も通常
文字とみなされるようになります。
<literal>e</literal>を指定した場合、置換文字列をPHPの式として評価
します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_eregi_replace</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-eregi-replace">
<refnamediv>
<refname>mb_eregi_replace</refname>
<refpurpose>
マルチバイト文字列に大文字小文字を区別せずに正規表現による置換を行う
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>mb_eregi_replace</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>replace</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_eregi_replace</function>は、マルチバイト文字列
<parameter>string</parameter>において、大文字小文字を区別せずに正
規表現<parameter>pattern</parameter>にマッチする文字列を
<parameter>replacement</parameter>に置換し、置換後の文字列を返しま
す。エラーの場合は、&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_replace</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-split">
<refnamediv>
<refname>mb_split</refname>
<refpurpose>マルチバイト文字列を正規表現により分割する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_split</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>limit</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_split</function>は、マルチバイト文字列
<parameter>string</parameter>において、正規表現
<parameter>pattern</parameter>により文字列を分割し、配列として返し
ます。
</simpara>
<simpara>
オプションの引数<parameter>limit</parameter>を指定した場合は、最大
<parameter>limit</parameter>個の要素に分割されます。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-match">
<refnamediv>
<refname>mb_ereg_match</refname>
<refpurpose>マルチバイト文字列が正規表現に一致するか調べる</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>mb_ereg_match</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt">
<type>string</type><parameter>option</parameter>
</methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_match</function>は、マルチバイト文字列
<parameter>string</parameter>が正規表現
<parameter>pattern</parameter>に一致する場合に&true;、そうでない場
合に&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search">
<refnamediv>
<refname>mb_ereg_search</refname>
<refpurpose>
指定したマルチバイト文字列が正規表現に一致するか調べる
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>mb_ereg_search</methodname>
<methodparam choice="opt">
<type>string</type><parameter>pattern</parameter>
</methodparam>
<methodparam choice="opt">
<type>string</type><parameter>option</parameter>
</methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search</function>は、マルチバイト文字列が正規表
現に一致するかどうか調べ、一致する場合に&true;、それ以外の場合に
&false;を返します。検索対象の文字列は、
<function>mb_ereg_search_init</function>により設定します。
正規表現を省略した場合は、前回のものを再利用します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_init</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-pos">
<refnamediv>
<refname>mb_ereg_search_pos</refname>
<refpurpose>
指定したマルチバイト文字列が正規表現に一致する部分の位置と長さを返
す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_pos</methodname>
<methodparam choice="opt">
<type>string</type><parameter>pattern</parameter>
</methodparam>
<methodparam choice="opt">
<type>string</type><parameter>option</parameter>
</methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_pos</function>は、マルチバイト文字列の中
に正規表現に一致する部分があるかどうか調べ、一致した場合には、1番
目の要素に一致した先頭の位置、2番目の要素に一致した長さ(バイト数)
を有する配列を返します。エラーを発生した場合は、&false;を返します。
検索対象の文字列は、<function>mb_ereg_search_init</function>により
設定します。正規表現を省略した場合は、前回のものを再利用します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_init</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-regs">
<refnamediv>
<refname>mb_ereg_search_regs</refname>
<refpurpose>
指定したマルチバイト文字列が正規表現に一致する部分を取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_regs</methodname>
<methodparam choice="opt">
<type>string</type><parameter>pattern</parameter>
</methodparam>
<methodparam choice="opt">
<type>string</type><parameter>option</parameter>
</methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_regs</function>は、マルチバイト文字列の中
に正規表現に一致する部分があるかどうか調べ、一致した場合には、1番
目の要素に一致した部分文字列全体、2番目の要素は最初の括弧でグルー
プ化された部分、3番目の要素は2番目の括弧でグループ化された部分といっ
たようになります。エラーを生じた場合は、&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_init</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-init">
<refnamediv>
<refname>mb_ereg_search_init</refname>
<refpurpose>
マルチバイト正規表現検索用の文字列と正規表現を設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_init</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>option</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_init</function>は、マルチバイト対応の正規
表現検索において検索対象の文字列及び正規表現を設定します。
この設定は、<function>mb_ereg_search</function>,
<function>mb_ereg_search_pos</function>,
<function>mb_ereg_search_regs</function>で使用されます。設定に成功
した場合は&true;、エラーを生じた場合は&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_regs</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-getregs">
<refnamediv>
<refname>mb_ereg_search_getregs</refname>
<refpurpose>
マルチバイト文字列が正規表現に一致する部分があるか調べる
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_getregs</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_getregs</function>は、直前の
<function>mb_ereg_search</function>,
<function>mb_ereg_search_pos</function>,
<function>mb_ereg_search_regs</function>で一致した部分文字列を取得
します。一致した場合には、1番目の要素に一致した部分文字列全体、2番
目の要素は最初の括弧でグループ化された部分、3番目の要素は2番目の括
弧でグループ化された部分といったようになります。エラーを生じた場合
は、&false;を返します。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_init</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-getpos">
<refnamediv>
<refname>mb_ereg_search_getpos</refname>
<refpurpose>
次の正規表現検索を開始する位置を取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_getpos</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_getpos</function>は、
<function>mb_ereg_search</function>,
<function>mb_ereg_search_pos</function>,
<function>mb_ereg_search_regs</function>で検索を開始する位置を返し
ます。位置は、文字列の先頭からのバイト数で表した値です。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_setpos</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.mb-ereg-search-setpos">
<refnamediv>
<refname>mb_ereg_search_setpos</refname>
<refpurpose>
次の正規表現検索を開始する位置を設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>mb_ereg_search_setpos</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>mb_ereg_search_setpos</function>は、
<function>mb_ereg_search</function>で検索を開始する位置を設定しま
す。
</simpara>
<para>
文字エンコーディングとしては、内部エンコーディングまたは
<function>mb_regex_encoding</function>で指定した文字エンコーディン
グが使用されます。
</para>
<note>
<para>
この関数は、PHP 4.2.0以降でサポートされています。
</para>
</note>
<para>
<function>mb_regex_encoding</function>,
<function>mb_ereg_search_init</function>も参照下さい。
</para>
</refsect1>
</refentry>
</reference>
<!-- 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:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
<!-- Keep this comment for vi/vim/gvim
vi: et:ts=1:sw=1
-->
|