I wrote a simple script below to simulate my problem.
Both my string and pattern contain unicode characters.

Basically, if I run it from command line (php -f test.php), it prints
"match" as expected.

But if I run it through web server (apache, http://localhost/test.php), it
prints "no match".

I am using PHP 5.3.
I am sure both use the same php.ini.

Any idea why it behaves differently?
How do I make it work through web server?


function myCallback($matches) {
    return $matches[0]; //do nothing, test only

$value = 'aaa äää';
$pattern = '/(\bäää)/u';

$value = preg_replace_callback($pattern, 'myCallback', $value, -1, $count);
if ($count > 0) {
    echo "match";
} else {
    echo 'no match';

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to