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

Inserting the current date/time while submitting the forum
What do I need to add below to update the current date/time? I have a field in the database called d

filesize() returns 0
I have a socket program that runs in an infinite loop, listening for connections, in this socket I h

utl_file open error
i have file in the unix path

Path /popdev01/pop/popdevb/tfi/

File name

2 decima places & How to reload my page
Hello There,

How do i put full-stop (.) after second figure from behind? ie if i have 123456

ok i need to join all this pages to make 1 neat code
i have 5 pages that make up my tv guide it works 100% but i want to make it 1 page if i can or 2, i

Multiple forms on the same page (safari)
Hello everyone,

I have 3 forms on the same page, that opens in a new window and submits to a

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

TemplatePower & AJAX
Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is b

selectbox+database connection retrive problem
Code: [Select]
<tr>
<th align="left" scope="c

Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The

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