Putting double spaces instead of single spaces


Posted on 16th Feb 2014 07:03 pm by admin

Im looking at trying to replace all single spacing between fields with double spacing

At present my file looks like this

Did you know?Explore Trending and Topic pages for more stories like this.
3 Caxxxan Maxxxet Waxxxxe Axxxxxxy Co.Kildare

but after the double spacing, I want it to look like

3 Caxxxan Maxxxet Waxxxxe Axxxxxxy Co.Kildare

The code I have so far is

Code: <?php
$fields=file('C:UsersMikeDesktop5april.txt');
foreach($fields as $i=>$field)
{
$field=str_replace(' ',',',$field);
$field=str_replace(' ',',',$field);
$fields[$i]=$field;
}
file_put_contents('C:UsersMikeDesktoptest.txt',implode("r",$fields));
?>

Any help would be great
No comments posted yet

Your Answer:

Login to answer
278 Like 52 Dislike
Previous forums Next forums
Other forums

modifying a property of an object from a different class
I have 2 classes:
- Math
- Distance

in my math class, I have this line:
$distance =

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Packet Design
Hi All,
Im new about network programming and I want to design a protocol but I have some question

php automatically escaping single quotes
I'm trying to test out my security a bit and I've noticed that php is escaping my single quotes. For

gmmktime or mktime
I live in the UK, i am within the GMT (with daylight saving time ie 1 hour difrence between summer a

phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";

How to use php and sql to check if values match the ones in a table (for logins)
How would I code it that the script takes two variables that are passed to it (UserID and PIN), and

Pagination won't carry results past page 2.
Hi all,

I've worked out my pagination script and its paginating fine until I click next from

Links not updating
I'm trying to fuel a simple navigation system for a news section. It works fine when it comes to ret

PHP Game
hy i was wondering what's the best method in order to make some automatic updates in a php game
<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash