<?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)
)
);
- Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array (
1 => 'http://example.com/my_custom_links_part1.xml',
2 => 'http://example.com/my_custom_links_part2.xml',
3 => 'http://example.com/my_custom_links_part3.xml',
)
preferences:
37.69 ms | 406 KiB | 5 Q