| 
		
			
			
				
			
			
				 
			
			
				
			
		 | 
		
			
			
				 
			
				
			
		 | 
	||||
| 
				Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.  You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us.  | 
		
		 
		![]()  | 
	
		
			
  | 	
	
	
		
		|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
| 
		 | 
	Thread Tools | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2003 
				Location: Mexico 
				
				
					Posts: 1,607
				 
				
				
				
				 | 
	
	
	
	
		
			
			 
				
				PHP code to rearrange sentances??
			 
			Anyone know of a php function, or snippet of code I can use to rearrange/randomize the order of sentences in a block of text? 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Too lazy to set a custom title 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Sep 2005 
				Location: Springfield 
				
				
					Posts: 13,826
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 shuffle() 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Make a bank with Chaturbate - the best selling webcam program        Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!! PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:  
			 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Just Doing My Own Thing 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2011 
				Location: London, Spain, New Zealand, GFY - Not Croydon... 
				
				
					Posts: 25,249
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 You could do it with any spinner type setup.... 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Raise Your Weapon 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				Location: Outback Australia 
				
				
					Posts: 15,601
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 If you want to shuffle the same every time then use this function  
		
	
		
		
		
		
		
	
	Code: 
	<?php
/* $seed variable is optional */
function SEOshuffle(&$items, $seed=false) {
  $original = md5(serialize($items));
  mt_srand(crc32(($seed) ? $seed : $items[0]));
  for ($i = count($items) - 1; $i > 0; $i--){
    $j = @mt_rand(0, $i);
    list($items[$i], $items[$j]) = array($items[$j], $items[$i]);
  }
  if ($original == md5(serialize($items))) {
    list($items[count($items) - 1], $items[0]) = array($items[0], $items[count($items) - 1]);
  }
}
?>
 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2003 
				Location: Mexico 
				
				
					Posts: 1,607
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Here's what I'm looking for.. 
		
	
		
		
		
		
		
		
			
		
		
	
	Example: $string = "Lorem ipsum is the most common form of "Greeking". However more and more people are sick and tired of using the same sample text over and over again. Also lorem ipsum is in latin and it may not always be the best choice. We tried to have text generated in some of the most widely used languages but if you are in desperate need of random text in your own language, send us an email and we'll add it here. "; $newstring = awesomeSentenceShufflingFunction($string); echo $newstring; ----- Output: We tried to have text generated in some of the most widely used languages but if you are in desperate need of random text in your own language, send us an email and we'll add it here. However more and more people are sick and tired of using the same sample text over and over again. Also lorem ipsum is in latin and it may not always be the best choice. Lorem ipsum is the most common form of "Greeking".  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Beer Money Baron 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2001 
				Location: brujah / gmail 
				
				
					Posts: 22,157
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 $sentences = explode('.', $string); 
		
	
		
		
		
		
			shuffle($sentences); echo implode(' ', $sentences); 
				__________________ 
		
		
		
		
	
	
  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2003 
				Location: Mexico 
				
				
					Posts: 1,607
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2001 
				Location: Toronto 
				
				
					Posts: 7,103
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Sentances? Try Google translate. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Beer Money Baron 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2001 
				Location: brujah / gmail 
				
				
					Posts: 22,157
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 $sentences = preg_split( '/\.|\!+/', $s); 
		
	
		
		
		
		
			array_map( 'trim', $sentences); echo implode( '. ', $sentences ); 
				__________________ 
		
		
		
		
	
	
  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 frc 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2003 
				Location: Bitcoin wallet 
				
				
					Posts: 4,663
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Basically you'll want to load them into an array and mix them up. Naturally they won't make a lot of sense afterwords. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Dec 2005 
				Location: Arizona/Indiana 
				
				
					Posts: 366
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Sorry, if you can't spell than PHP is above your pay grade. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2003 
				Location: Mexico 
				
				
					Posts: 1,607
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2003 
				Location: Mexico 
				
				
					Posts: 1,607
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Yeah, ok smart ass.  "sentences"  ....I'm DOG fucking tired today.  
		
	
		
		
		
		
		
	
	Did you read what I wrote in the same post? "Anyone know of a php function, or snippet of code I can use to rearrange/randomize the order of sentences in a block of text?" ..seems "sentences" was spelled correctly. Did you notice my example.. $newstring = awesomeSentenceShufflingFunction($string); ...Sentences is spelled correctly there too. ..give me a fucking break. Anyways, I need sleep. I'm out. Thanks to all of those with something constructive to offer. I'll check back tomorrow.  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: May 2011 
				Location: Seoul, Korea 
				
				
					Posts: 343
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#15 | |
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Dec 2005 
				Location: Arizona/Indiana 
				
				
					Posts: 366
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 http://www.wikihow.com/Use-Than-and-Then  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#16 | |
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
			
			 Quote: 
	
 1) it doesn't actually shuffle sentences; 2) it doesn't split sentences that end with "..." and "?"; 3) the result of array_map() will be lost; 4) all exclamation marks will be replaced with dots. So here is the fixed version: preg_match_all('/.*?[\?|\.\.\.|\.|\!]+/s', $s, $sentences); $sentences[0] = array_map('trim', $sentences[0]); shuffle($sentences[0]); echo implode(' ', $sentences[0]); 
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#17 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Or even shorter: 
		
	
		
		
		
		
			preg_match_all('/.*?[\?|\.\.\.|\.|\!]+/s', $s, $sentences); shuffle($sentences[0]); echo implode(' ', array_map('trim', $sentences[0])); 
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#18 | |
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: May 2011 
				Location: Seoul, Korea 
				
				
					Posts: 343
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	 | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#19 | 
| 
			
			
			
			 Beer Money Baron 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2001 
				Location: brujah / gmail 
				
				
					Posts: 22,157
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I was drunk coding!  I'll take a look and give it a try. 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	
  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#20 | 
| 
			
			
			
			 Beer Money Baron 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2001 
				Location: brujah / gmail 
				
				
					Posts: 22,157
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I like this version so far: 
		
	
		
		
		
		
			Code: 
	$string = <<<EOS Lorem ipsum is the most common form of "Greeking". However more and more people are sick and tired of using the same sample text over and over again. Also lorem ipsum is in latin and it may not always be the best choice. We tried to have text generated in some of the most widely used languages but if you are in desperate need of random text in your own language, send us an email and we'll add it here. Adding a few extra examples... you mean like this? Hmm, what the hell?!!! EOS; preg_match_all( '/[^.?!]+[.?!]+/m', $string, $matches ); $sentences = array_map( 'trim', $matches[0] ); shuffle( $sentences ); $sentences = array_map( 'ucfirst', $sentences ); echo implode( ' ', $sentences ); Outputs: However more and more people are sick and tired of using the same sample text over and over again. We tried to have text generated in some of the most widely used languages but if you are in desperate need of random text in your own language, send us an email and we'll add it here. You mean like this? Adding a few extra examples... Hmm, what the hell?!!! Lorem ipsum is the most common form of "Greeking". Also lorem ipsum is in latin and it may not always be the best choice. 
				__________________ 
		
		
		
		
		
			
		
		
	
	
  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 |