<?php
$text = <<<TEXT
Павел
Дуров fsdf sdf sdf
TEXT;
$filter = 'Павел Дуров';
$filter = mb_strtolower($filter);
$parts = explode(' ', $filter);
$parts = array_map('trim', $parts);
$parts = array_map('preg_quote', $parts);
$filter = implode('.*', $parts);
// echo preg_match("~{$filter}~uis", $text);
$a = preg_split('/[x00-x20]+/', $text);
$a = array_map('trim', $a);
$a = array_filter($a);
print_r($a);
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
- Array
(
[0] => Павел
Дуров
)
preferences:
195.81 ms | 404 KiB | 292 Q