I want to build an array in php containing all possible permutation of a word. so it will be (pseudo code)
function permutate($word){ for ($i=0; $i<count($word); $i++){ ...confused here... array_push($myArray, $newWord) } return $myArray; }
So let's say that I entered "School", I have to get the array back
{school, school, sChool, SCHool, schOOl, ... SCHOOL}
I know functions that use a string or the first character, but I'm really struggling with how to do this.
source share