fork download
  1. <?php
  2. $story = array();
  3. $story[] = 'As a developer, I want to refactor the PHP & javascript so that it has less duplication';
  4. $story[] = ' As a developer, I want to configure Jenkins so that we have continuous integration and I love mysql';
  5. $story[] = ' As a tester, I want the test cases defined so I can test the system using php language and phpunit framework';
  6.  
  7. $languages = [
  8. 'php' => 0,
  9. 'javascript' => 0,
  10. 'mysql' => 0,
  11. ];
  12.  
  13. for( $i=0,$size=count($story); $i<$size; ++$i )
  14. {
  15. $text = strtolower($story[$i]);
  16. foreach( $languages as $word => $nb )
  17. $languages[$word] += substr_count($text, $word);
  18. }
  19.  
  20. var_export($languages);
  21. // your code goes here
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
array (
  'php' => 3,
  'javascript' => 1,
  'mysql' => 1,
)