Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 472 Bytes

remove_any_last.md

File metadata and controls

13 lines (10 loc) · 472 Bytes

Remove any last character from a string

$new_str = substr($str, 0, -1);
  • $new_str - string without last character will be saved here
  • substr - function to extract part of the given string
  • $str - original string to remove last character from
  • 0, - extract substring starting from beginning of original string ...
  • -1) - ... and ending one character prior to the end of the original string

group: trim