<?php
$str = 'nilpointer.net';
$keyword = 'net';
if (str_ends_with($str, $keyword)) {
echo 'The string ends with "'.$keyword.'"';
} else {
echo 'The string does not ends with "'.$keyword.'"';
}
?>
Output
The string ends with "net"