How to generate multiple string base on given string with space separator. Ex.: I have one string like
Ex.:1
'This is string'
will output following strings:
'This is', 'This string', 'is string'
$arrStrSplit = explode($splitBy, $strInfo);
for($outer = 0; $outer < count($arrStrSplit); $outer++)
{
for($inner = $outer+1; $inner < count($arrStrSplit); $inner++)
{
array_push($arrStrSplitPair, $arrStrSplit[$outer].' '.$arrStrSplit[$inner]);
}
}
What if have multiple word string more than 3+
Ex.2:
'This is new string'
Output:
'This is', 'This new', 'This string', 'is new', 'is string', 'new string',
'This is new', 'This is string', 'This new string', 'is new string'
so on : Input string have any no. of words. From 2 to 15-20 etc...
i.e. No. of word string from 2 TO (No. of word of given string - 1)