fork(1) download
  1. <?php
  2.  
  3. $string = "one and two and three and four and five";
  4. $stringArray = explode(" and ", $string);
  5. $stringArrayItemCount = count($stringArray);
  6. $stringArrayLastItem = $stringArray[$stringArrayItemCount-1];
  7. unset($stringArray[$stringArrayItemCount-1]);
  8. $stringArray = array(implode(" and ",$stringArray),$stringArrayLastItem);
  9.  
  10. print_r($stringArray);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => one and two and three and four
    [1] => five
)