function my_spintax( $string ) {
$data = preg_match_all( "/(?=\{).*?(?=\})./", $string, $match );
if ( !empty( $match ) ) {
foreach ( $match as $key => $value ) {
if ( !empty( $value ) ) {
foreach ( $value as $values ) {
$v = explode( "|", $values );
$i = array_rand( $v );
$string = str_replace( $values, str_replace( array( "{", "}" ), "", $v[ $i ] ), $string );
}
}
}
}
return $string;
}