13-14 betűből álló településnevek szkript


SUBMITTED BY: Guest

DATE: Dec. 18, 2013, 9:59 p.m.

FORMAT: PHP

SIZE: 1.1 kB

HITS: 969

  1. <?php
  2. $telepulesek = file("telepulesek.txt");
  3. foreach ($telepulesek as $telepules) {
  4. $telepules = str_replace("\n","",$telepules);
  5. $hossz = strlen($telepules);
  6. $cs = substr_count($telepules, "cs") + substr_count($telepules, "Cs");
  7. $dz = substr_count($telepules, "dz") + substr_count($telepules, "Dz");
  8. $dzs = substr_count($telepules, "dzs") + substr_count($telepules, "Dzs");
  9. $gy = substr_count($telepules, "gy") + substr_count($telepules, "Gy");
  10. $ly = substr_count($telepules, "ly") + substr_count($telepules, "Ly");
  11. $ny = substr_count($telepules, "ny") + substr_count($telepules, "Ny");
  12. $sz = substr_count($telepules, "sz") + substr_count($telepules, "Sz");
  13. $ty = substr_count($telepules, "ty") + substr_count($telepules, "Ty");
  14. $zs = substr_count($telepules, "zs") + substr_count($telepules, "Zs");
  15. if ($dzs>0) {
  16. $dz = $dz - $dzs;
  17. }
  18. $hossz = $hossz - $cs - $dz - $dzs - $gy - $ly - $ny - $sz - $ty - $zs;
  19. if (($hossz == 13) || ($hossz == 14))
  20. echo $telepules."\n";
  21. }
  22. ?>

comments powered by Disqus