У меня есть этот массив:array_filter() возвращает пустой массив
array
0 => string 'http://example.com/site.xml'
1 => string 'http://example.com/my_custom_links_part1.xml'
2 => string 'http://example.com/my_custom_links_part2.xml'
3 => string 'http://example.com/my_custom_links_part3.xml'
4 => string 'http://example.com/my_some_other_custom_links_part1.xml'
и этот код, чтобы получить ссылки, которые содержат "my_custom_links" в имени (а не "my_come_other_custom_links")
<?php
$matches = array_filter($urls, function($var) { return preg_match("/^my_custom_links$/", $var); });
echo "<pre>";
print_r($urls); // will output all links
echo "</pre>";
echo "<pre>";
print_r($matches); // will output an empty array
echo "</pre>";
?>
Мне нужно получить массив с 3 элементами, но я получаю пустой массив.