...

View Full Version : How do you convert a blank space to a character?



unrelenting
01-05-2008, 07:58 PM
What code would I use to convert a blank space in a query to a character, namely a period.

I want to parse this:

sample query text or possibly numbers

to this:

sample.query.text.or.possibly.numbers

I wouldn't need periods before or after the query.

Can anyone fill me in on this?

mlseim
01-05-2008, 08:05 PM
<?php
$string="sample query text or possibly numbers";
$string=str_replace(" ", ".", $string);
echo $string;
?>

result is:
sample.query.text.or.possibly.numbers

unrelenting
01-05-2008, 08:13 PM
<?php
$string="sample query text or possibly numbers";
$string=str_replace(" ", ".", $string);
echo $string;
?>

result is:
sample.query.text.or.possibly.numbers

Much obliged. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum