Check if String Ends with Substring using PHP

str_ends_with function

<?php

$text = 'Hello world';
$result = str_ends_with($text, 'world');

echo $result ? 'Yes' : 'No';

Leave a Comment

Cancel reply

Your email address will not be published.