Advertisement
natalyayemelyanova

Никита Хворостенко 2

Mar 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. function func(string $strStart, string $strEnd) : bool
  2. {
  3. $strStartChars = str_split(trim($strStart));
  4. $strEndChars = str_split(trim($strEnd));
  5. $strStartChars = array_diff($strStartChars, [' ']);
  6. $strEndChars = array_diff($strEndChars, [' ']);
  7.  
  8. foreach( $strStartChars as $char )
  9. if( in_array($char, $strEndChars) )
  10. unset($strEndChars[array_search($char, $strEndChars)]);
  11.  
  12. return count($strEndChars) == 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement