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!