PHP 8.6.0 Beta 1 is available for testing

Voting

: six plus one?
(Example: nine)

The Note You're Voting On

easai
16 years ago
Here are Java like startsWith/endsWith implementations in PHP.

<?php
    function startsWith($haystack,$needle)
    {
      $res=FALSE;
      if(mb_strripos($haystack,$needle,0,"utf-8")==0)
         $res= TRUE;
      return $res;
    }

    function endsWith($haystack,$needle)
    {
      $res=FALSE;
      $len=mb_strlen($haystack);
      $pos=$len-mb_strlen($needle);
      if(mb_strripos($haystack,$needle,0,"utf-8")==$pos)
         $res= TRUE;
      return $res;
    }
?>

<< Back to user notes page

To Top