PHPverse 2025

Voting

: one minus one?
(Example: nine)

The Note You're Voting On

haugas at gmail dot com
17 years ago
If you don't know exactly, how many times your string is encoded, you can use this function:

<?php

function _utf8_decode($string)
{
$tmp = $string;
$count = 0;
while (
mb_detect_encoding($tmp)=="UTF-8")
{
$tmp = utf8_decode($tmp);
$count++;
}

for (
$i = 0; $i < $count-1 ; $i++)
{
$string = utf8_decode($string);

}
return
$string;

}

?>

<< Back to user notes page

To Top