Home > Backend Development > PHP Tutorial > PHP string search to find the last occurrence of a character

PHP string search to find the last occurrence of a character

WBOY
Release: 2016-07-25 08:52:21
Original
1689 people have browsed it
  1. $str = 'http://bbs.it-home.org phper,php learning_php technology_php website construction_php programmers focus on php technology research and learning_characters appear Times';
  2. echo substr_count($str,'php').'
    ';
  3. echo substr_count($str,'h').'
    ';
  4. echo substr_count($ str,'php programmer');
  5. ?>
Copy the code

Output results: 5 3 1 Related links:

  • php string search function (strrpos and strchr)
  • php string search function strstr(), strrchr() examples


source:php.cn
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