PHP - Function endswith


/ Published in: PHP
Save to your folder(s)

This function checks if the $stringComplete variable ends with the string $endString.


Copy this code and paste it in your HTML
  1. function endsWith($stringComplete, $endString)
  2. {
  3. $length = strlen($endString);
  4. $start = $length * -1; //negative
  5. return (substr($stringComplete, $start) === $endString);
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.