Advertisement
natalyayemelyanova

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

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