//方法1
function strpos1($str,$str_find)
{
    $a = str_split($str);
    $b = str_split($str_find);
    foreach ($a as $ka=>$va)
    {
        if ($va==$str_find[0])
        {
            $match=true;
            //循环看看后几个是否相等
            $len = count($b);
            for ($i=0;$i<$len;$i++)
            {
                if ($a[$ka+$i]!==$b[$i]){
                    $match = false;
                }
            }

        }
        if ($match)
        {
            $res=$ka;
            break;
        }
    }

    return $res;
}

//方法2

hea7r9o4
1 声望0 粉丝