We can generate all possible combinations of given string. Here I made a function get_string_combinations($str), this function will accept string as a parameter and will give you all possible combinations of that string. In this function, I have converted given string into an array of words by using explode function. Then counted the number of words in that array by using the count() function.
The pow() function is used to calculate the result of exponent and power by multiplying the exponent as a number of times as power. Here I have used bin() function to convert decimal number to binary number. str_pad() function is used to pad the string to new length, by default, it will pad to the right side of the string, I gave the parameter " STR_PAD_LEFT " pad to the left side of the string.