startsWith / hasPrefix


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



Copy this code and paste it in your HTML
  1. function startsWith($check, $string) {
  2. if ($check === "" || $check === $string) {
  3. return true;
  4. } else {
  5. return (strpos($string, $check) === 0) ? true : false;
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.