Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function checkString($string1, $string2){
- $string1 = str_replace(' ','', $string1);// remove space
- $string2 = str_replace(' ','', $string2);// remove space
- $arr1 = str_split($string1);
- $arr2 = str_split($string2);
- foreach ($arr1 as $key1 => $letter){
- foreach ($arr2 as $key => $charset){
- if($charset == $letter){
- unset($arr2[$key]);
- unset($arr1[$key1]);
- break;
- }
- }
- }
- if(empty($arr2)&&empty($arr1)){
- return true;
- } else {
- return false;
- }
- }
- checkString('clockwise','owe clicks');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement