If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
str_ends_with() function check करता है कि क्या कोई String pass की गयी substring value से end हो रही है। match होने पर true return होता है otherwise false .
str_ends_with() function PHP version 8 में add किया गया था , इसलिए हो सकता है कि PHP के older version में error दे।
str_ends_with(string $haystack , $needle);
string $haystack | required : string value जो हमें $needle string में check करनी है।
string $needle | required : string value जिसमे हमें $haystack string check करनी है।
Return Value : Boolean value true / false return होता है।
File : php_str_ends_with.php
<?php
$str = "learnhindituts.com";
if (str_ends_with($str, "com")) echo "$str ends with com. br>";
if (str_ends_with($str, "Com")) echo "$str ends with Com.";
/*now try with empty string*/
if (str_ends_with("", $str)) echo "$str ends with empty string";
if (str_ends_with("", "")) echo "empty string ends with empty string";
?>
learnhindituts.com ends with com. empty string ends with empty string
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook