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

PHP string search to find the last occurrence of a character

WBOY
WBOYOriginal
2016-07-25 08:52:211627browse
  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


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