phpstringcodeigniterplaintext

Plain text email padding with PHP


I am building a plain text email with Codeigniter but I want to pad some headings:

At the moment they are coming out like:

Client : ABC Structures Ltd
Contact : Jeoff Black
Ticket ID : 83738

But I really want it like this:

Client     : ABC Structures Ltd
Contact    : Jeoff Black
Ticket ID  : 83738

I tried using str_pad() but it doesn't seem to work. I tried using " " and even chr(32) but it just doesn't seem to do anything. If I pad it with a normal character like - it works fine, but I just want spaces.

I tried just manually spacing the template, but the spaces are removed.

So, I've tried:

<?php echo str_pad("Client", 15);?>: <?php echo $client_name; ?>

And even

Client      : <?php echo $client_name; ?>

Its not even that important, I'm just determined to resolve it... I'm guessing I need some sort of unicode character in there...? Not sure how to output it...

Thanks.


Solution

  • This issue was down to me having HTML content, rather than plain text. Doh.