PHP strpos not working

2019-07-16 18:40发布

I've always had problems with strpos, I understand the num v. boolean issue, but I can NOT get this working. The $cur_key value is something like "page=>name"...

$pos = strpos($cur_key, "=>");
if ($pos !== false) {
   $mod = explode("=>",$cur_key);
   $path = $mod[0];
   $param = $mod[1];                                
}else{
   $path = $cur_key;
}

If it's in there it should split it into the two values but no matter what I try it's always just returning the original value...

标签: php strpos
1条回答
Bombasti
2楼-- · 2019-07-16 19:29
$mod = explode('=>',$cur_key);
$path=$mod[0];
if (sizeof($mod)>1) $param=$mod[1]; else $param='';
查看更多
登录 后发表回答