Saturday, 4 May 2013

Replace whitespace of string into dash or comma using php

Replaceing  whitespace into dash or comma this problem face by the beginners of we try to solve this problem using php function.( whitespace in string,remove space from string.replace comma and dash place of whitespace.)


Exampal: First of all we take a string

          // create php variable $str
          $str="This is only for test";
         // now set this string in str_replace
         $string=str_replace(" ","-",$str) ;
          echo $string;


No comments: