I am using this function which is
used to spin text.
Currently it looks to me like it is selected an
element from the $tStringToken array at random.
These two lines seem to be doing that:
Expand|Select|Wrap|Line Numbers
- $i = rand(0,$tStringCount);
- $replace = $tStringToken[$i];
all of the available elements in the array and then when finished
starts again with the first element of the array.
But I am having trouble working it out.
This is the function I am working on.
Expand|Select|Wrap|Line Numbers
- function spin($pass){
- $mytext = $pass;
- while(inStr("}",$mytext)){
- $rbracket = strpos($mytext,"}",0);
- $tString = substr($mytext,0,$rbracket);
- $tStringToken = explode("{",$tString);
- $tStringCount = count($tStringToken) - 1;
- $tString = $tStringToken[$tStringCount];
- $tStringToken = explode("|",$tString);
- $tStringCount = count($tStringToken) - 1;
- $i = rand(0,$tStringCount);
- $replace = $tStringToken[$i];
- $tString = "{".$tString."}";
- $mytext = str_replaceFirst($tString,$replace,$mytext);
- }
- return $mytext;
- }
Thanks.
.