Home > Backend Development > PHP Tutorial > 帮忙看下如何会返回null

帮忙看下如何会返回null

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:46:23
Original
1052 people have browsed it

帮忙看下怎么会返回null

本帖最后由 snowlove 于 2013-06-17 18:27:34 编辑
<?php<br />
function newtripos($str,$findstr,$count,$off=0){<br />
	$pos=stripos($str,$findstr,$off);<br />
	$count--;<br />
	if($count>0 && $pos!=false){<br />
		$pos=newtripos($str,$findstr,$count,$pos+1);<br />
	}else{<br />
		var_dump($pos);<br />
		return $pos;<br />
	}<br />
}<br />
$a="456123456455654466";<br />
$b=newtripos($a,'6',4);<br />
var_dump($b);<br />
?>	
Copy after login


执行后显示$b是null。而在函数返回前,执行的var_dump($pos),显示是int(16)。
为什么var_dump($b)会是null?

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template