Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. <?php
  2. function string($string) {
  3.   $arraySize = count($string);
  4.  
  5.   for($x = 0; $x < $arraySize; $x++) {
  6.     if ($x < $arraySize-1) {
  7.       echo $string.",";
  8.     } else {
  9.       echo $string;
  10.     }
  11.   }
  12.   return $string;
  13. }
  14.  
  15. $string = "this,is,a,test";
  16. echo string($string);
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement