fork(1) download
  1. <?php
  2.  
  3. $str = "In order to successfully build your backlinks in a highly competitive industry (or if you're targeting highly competitive keywords), you have to get smart about your strategy. That means using the best back-link building tools available";
  4. $split = explode(' ', $str); // Split up the whole string
  5. $chunks = array_chunk($split, 3); // Make groups of 3 words
  6. $result = array_map(function($chunk) { return implode(' ', $chunk); }, $chunks); // Put each group back together
  7. var_dump($result);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
array(12) {
  [0]=>
  string(11) "In order to"
  [1]=>
  string(23) "successfully build your"
  [2]=>
  string(14) "backlinks in a"
  [3]=>
  string(27) "highly competitive industry"
  [4]=>
  string(13) "(or if you're"
  [5]=>
  string(28) "targeting highly competitive"
  [6]=>
  string(19) "keywords), you have"
  [7]=>
  string(12) "to get smart"
  [8]=>
  string(20) "about your strategy."
  [9]=>
  string(16) "That means using"
  [10]=>
  string(18) "the best back-link"
  [11]=>
  string(24) "building tools available"
}