function spintext_spin( $spintext )
{
preg_match( '#\{(.+?)\}#is', $spintext, $tmp );
if( empty( $tmp ) ): return $spintext; endif; # >>>
$tmp = $tmp[1];
if( strpos( $tmp, '{') !== false ):
$tmp = substr( $tmp, strrpos( $tmp, '{' ) + 1 );
endif;
$parts = explode( '|', $tmp );
$spintext = preg_replace( "+\{" . preg_quote( $tmp ) . "\}+is", $parts[array_rand( $parts )], $spintext, 1 );
return spintext_spin( $spintext );
}