3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php mb_internal_encoding('UTF-8'); $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 = mb_split('\s+', $text); $a = array_map('trim', $a); $a = array_filter($a); print_r($a);
Output for 7.1.7
Array ( [1] => Павел [2] => Дуров [3] => fsdf [4] => sdf [5] => sdf )