- array_map: documentation ( source)
- mb_split: documentation ( source)
- print_r: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- array_filter: documentation ( source)
- mb_strtolower: documentation ( source)
<?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 = mb_split('[x00-x20]+', $text);
$a = array_map('trim', $a);
$a = array_filter($a);
print_r($a);