Advertisement
natalyayemelyanova

Вячеслав Гречка

Mar 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. function check_strings($str1, $str2)
  3. {
  4. $str_array1 = str_split($str1);
  5. $str_array2 = str_split($str2);
  6. foreach($str_array1 as $key => $value)
  7. {
  8. if($value == ' ')
  9. {
  10. unset($str_array1[$key]);
  11. }
  12. }
  13. foreach($str_array2 as $key => $value)
  14. {
  15. if($value == ' ')
  16. {
  17. unset($str_array2[$key]);
  18. }
  19. }
  20. if(array_diff($str_array1, $str_array2) && array_diff($str_array2, $str_array1))
  21. {
  22. echo 'false';
  23. }
  24. else
  25. {
  26. echo 'true';
  27. }
  28. }
  29. check_strings('clockwise', 'owe clicks');
  30. // check_strings('clockwise', 'clockwork');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement