I have the following snippet of function and call to another function for returning tabs to format code.

public function makelinks ($urls_data) {
    $i = 5;
    $tabs   = $this->echo_tabs($i);
    $output = "$tabs<ul class=\"url_list\">\n";

public function echo_tabs($i){
    $x  = 0;
    $o = '';
    for ($x;$x<$i;$x++) {
        $o .= "\t"; 
    return $o;

What I would like is for $output to result in \t\t\t\t\t<ul class=\"url_list\">\n the \t's translating to actual tabs when a browser view source is generated. I am aware if I simply had that block string of characters assigned to $output, then they would have the desired result in the browser. Instead the \t's are echoing out as a string and displaying as unformatted and unwanted text.

To try and generate the desired result, I have also tried $o .= '\t'; as well as $o .= "\\t";. Neither of these is working either. I have googled a lot on this using terms such as 'assigning tabs to variable php'.

What would be the method for prepending or appending strings of tabs to code so they translate as tabs?

It works perfectly well in my browser (Firefox 30 on Win7). Clicking on a View page source it shows 5 tabs.

Don't I feel like an idiot. I have no idea what I was doing wrong last night. It was late when I tried working on this. It was not working so I thought Leave it. Document what you did and post it somewhere in the morning.

Tried it again and it works no problem