A
A
Alexey2016-02-02 23:32:20
PHP
Alexey, 2016-02-02 23:32:20

Why is preg_match case sensitive?

Hello! I can't understand why even with the i modifier set, preg_match distinguishes between case?

<?php
$text ='монитор Монитор';
$val = strtolower('Монит');

echo preg_replace('/('.$val.'.*?)/i', '<b>$1</b>$2', $text);
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2016-02-02
@dzheka3d

Set the modifier u , anything can happen with Cyrillic)
and use mb_* when dealing with Cyrillic, so that there are fewer surprises

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question