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

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

2 things: enter doesn't work in IE & empty form
i have this search form that works well except for 2 things.

1) on IE when i hit enter instea

Email/MMS to Site
Hey guys. I'm looking for a way for a user to upload images and/or text via their cell phones. It

session_destroy();
new to php
I have a simple login and am trying to write a logout.
I set a $_SESSION var to 1 i

str_replace help
I am thinking str_replace is my only option to filter outputs from my database to convert them to sa

Need help with PHP/MySQL drop down menu
I need help on how I can implement a drop down menu which queries mysql database and output the avai

Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What

Prevent PHP mail( ) from appending hostname to from address
Hey guys,

I want to be able to send texts to phones via email (since each phone has their own

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

cstdatomic (c++0x std::atomic) / g++ 4.4
Hello,

I'm trying to use cstdatomic (std::atomic in the upcoming c++0x standard) in g++

Dynamic memory problem
Hey,

At the beginning of my code, I have this line:

Shape* gShape = 0;

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