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

passing an array of objects after submit
How do I do this? This is what I have tried and it is not working.

<form method="

Different actions for different parts of a string
<?php
function dosomething($string, $else = '') {
if (empty($else))
$string

max function question
Hi All
Ihave a table that holds shipment numbers and dates like this

select * from

PHP Mysql Staff Induction System
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right directi

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) {

$attachments = array();

Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get

Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.

So I have a bas

a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload

file downloaded can't be read !!
<?php
$fileName = 'mypic.jpg';
$mimeType = 'image/jpeg';
header('content-dispositio

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