<?php

    $text = 'Hello Great Super World!';
    $res  = sprintf($text);

    if (strripos(strToHex($text), 'C2A0') !== false) {
        echo "Test: The string $text contains a no-break space (C2A0)";
    }
    echo "\n<br/>\n";

    echo "Before sprintf: $text (hex: " .strToHex($text) . ")";
    echo "\n<br/>\n";
    echo "After  sprintf: $res (hex: " . strToHex($res) . ")";

    echo "\n<br/>\n";

    if ($text === $res) {
        echo "Both strings are equal! :-)";
    } else {
        echo "Strings are different! :-(";
    }

    echo "\n<br/>\n";

    function strToHex($string) {
        $hex='';
        for ($i=0; $i < strlen($string); $i++) {
            $hex .= dechex(ord($string[$i]));
        }
        return $hex;
    }
?>

