PHP Function to check if string ends with given substring ends_with()

Here is small php string function to determine that string is end with given substring, characters or symbols.

Source Code:

<?php 
/**
 * Determine if a given string ends with a given substring.
 *
 * @param  string  $haystack
 * @param  string|array  $needles
 * @return bool
 */

function ends_with($haystack, $needles)
{
	foreach ((array) $needles as $needle)
	{
		if ((string) $needle === substr($haystack, -strlen($needle))) return true;
	}
return false;
}


Output / Usage:

<?php 

$string = "EduZip is also filled with the fully solved previous exam papers";

if(ends_with($string,'papers')){
    echo 'TRUE';
} else {
    echo 'FALSE';
}

Comments: (Your feedback is valuable to us)