Counting Substrings in PHP
Given a string:
<?php
$str = 'aaa bbb ccc';
?>
Count the number of words in this string.
Given a string:
<?php
$str = 'hello hello world hello';
?>
Count how many times the substring 'hello' occurs in the string.
Given a string:
<?php
$str = '※※※';
?>
Count how many times the substring '※' occurs in the string.
Given a string:
<?php
$str = 'abracadabra';
?>
Count how many times each character appears in the string.
Given a string:
<?php
$str = 'The quick brown fox jumps over the lazy dog';
?>
Count the number of words longer than three characters.