PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function rtrim_word(string $haystack, string $needle): string { if (!str_ends_with($haystack, $needle)) { return $haystack; } return substr_replace($haystack, '', -strlen($needle)); } var_export( rtrim_word('this is a hamstrïng', 'strïng') );
Show:  
Copy Clear