PHP converts a string from one character to another function convert_cyr_string ()

Source: Internet
Author: User

Instance

Convert a string from one character set to another:

<?php$str = "Hello world! Æøå "; Echo $str. "<br>"; Echo convert_cyr_string ($str, ' w ', ' a '); >

Definition and usage

The convert_cyr_string () function converts a string from one Cyrillic character set to another.

The supported Cyrillic character sets are:

K-koi8-r

w-windows-1251

I-iso8859-5

a-x-cp866

d-x-cp866

M-x-mac-cyrillic

Note: This function is binary safe.

Grammar

Convert_cyr_string (String,from,to)

Parameter description

string is required. Specifies the string to convert.

From required. A character that specifies the source Cyrillic character set.

to required. A character that specifies the target Cyrillic character set.

Technical details

Return value: returns the converted string.

PHP version: 4+

Convert_cyr_string instances

XML file:

<?xml version= "1.0" encoding= "iso-8859-1"? ><note><to>george</to><from>john</ From>

PHP Code:

<?php$xml = simplexml_load_file ("Test.xml"); foreach ($xml->children () as $child)  {  echo "child node:". $child;  }? >

The output is similar to:

Child node:georgechild node:johnchild node:reminderchild Node:don ' t forget the meeting!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.