Home >Backend Development >PHP Tutorial >strrchr intercepts spaces

strrchr intercepts spaces

WBOY
WBOYOriginal
2016-12-01 00:26:031299browse

As in the title:

<code>echo strrchr('123.jpg','.').'<br/>';
echo strrchr('123 jpg',' ').'<br/>';
</code>

Result:
.jpg
jpg
Why does the result contain no spaces when intercepting spaces? Is it taken by default?

Reply content:

As in the title:

<code>echo strrchr('123.jpg','.').'<br/>';
echo strrchr('123 jpg',' ').'<br/>';
</code>

Result:
.jpg
jpg
Why does the result contain no spaces when intercepting spaces? Is it taken by default?

The questioner, this pot strrchr is not memorized, you are outputting it in the browser, and it was eaten by your browser. Please echo str_replace(' ','&nbsp',strrchr('123 jpg',' ').'<br/>'); to view, or output the viewing results in the form of CLI, the spaces are There is output.
strrchr intercepts spaces
strrchr intercepts spaces

var_dump(); is a good function.

var_dump(strrchr('123 jpg',' '));

Statement:
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