fork download
  1. <?php
  2.  
  3. function star($word){
  4. for ($x = 1; $x <= strlen($word); $x++) {
  5. $star[] = "*";
  6. }
  7. return implode("",$star)." = ".$word;
  8. }
  9.  
  10. $sentence = "Today is Monday";
  11. $word=explode(" ", $sentence);
  12. $count = count(explode(" ", $sentence));
  13. //$count2 = count(explode(" ", $word));
  14. echo "Sentence <b>\"".$sentence."\"</b> have : <br>";
  15. echo "Count word = $count<br>\n";
  16. foreach($word as $words){
  17. echo star($words)."<br>";
  18. }
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Sentence <b>"Today is Monday"</b> have : <br>Count word = 3<br>
***** = Today<br>** = is<br>****** = Monday<br>