- var_export: documentation ( source)
- array_filter: documentation ( source)
- str_contains: documentation ( source)
<?php
$array = [
'http://example.com/site.xml',
'http://example.com/my_custom_links_part1.xml',
'http://example.com/my_custom_links_part2.xml',
'http://example.com/my_custom_links_part3.xml',
'http://example.com/my_some_other_custom_links_part1.xml',
];
$needle = 'my_custom_links';
var_export(
array_filter(
$array,
fn($haystack) => str_contains($haystack, $needle)
)
);