Home  >  Article  >  Backend Development  >  strrchr intercepts spaces

strrchr intercepts spaces

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

As in the title:

echo strrchr('123.jpg','.').'
'; echo strrchr('123 jpg',' ').'
';

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

Reply content:

As in the title:

echo strrchr('123.jpg','.').'
'; echo strrchr('123 jpg',' ').'
';

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(' ',' ',strrchr('123 jpg',' ').'
');
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