Replaceing whitespace into dash or comma this problem face by the beginners of php.now we try to solve this problem using php function.( whitespace in string,remove space from string.replace comma and dash place of whitespace.)
str_replace(find,replace,string)
Exampal: First of all we take a string
<?php
// create php variable $str
$str="This is only for test";
// now set this string in str_replace
$string=str_replace(" ","-",$str) ;
echo $string;
?>
//output
This-is-only-for-test
str_replace(find,replace,string)
Exampal: First of all we take a string
<?php
// create php variable $str
$str="This is only for test";
// now set this string in str_replace
$string=str_replace(" ","-",$str) ;
echo $string;
?>
//output
This-is-only-for-test
No comments:
Post a Comment