3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $files = [ '/usr/share/nginx/wordpress/wp-content/plugins/myplugin.php', '/usr/share/nginx/wordpress/wp-content/themes/index.php', '/usr/share/nginx/wordpress/wp-content/themes/mytheme.php', '/usr/share/nginx/wordpress/wp-content/plugins/akismet.php', '/usr/share/nginx/wordpress/wp-content/uploads/november.jpg', ]; $exclude = [ '/usr/share/nginx/wordpress/wp-content/plugins/myplugin.php', '/usr/share/nginx/wordpress/wp-content/uploads', ]; // tamamen eşit klasör ya da dosya = 0 // klasörden dolayı alt dosya olabilir = 1 // hiç eşleşmeyebilir = -1 var_dump(array_udiff($files, $exclude, function($a, $b) { if (strtolower($a) == strtolower($b) || strpos($a, $b) !== false) { return 0; } else if ($a > $b) { return -1; } return 1; }));
Output for 5.6.30, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.3.0beta2
array(3) { [1]=> string(54) "/usr/share/nginx/wordpress/wp-content/themes/index.php" [2]=> string(56) "/usr/share/nginx/wordpress/wp-content/themes/mytheme.php" [3]=> string(57) "/usr/share/nginx/wordpress/wp-content/plugins/akismet.php" }