I have the following snippet of function and call to another function for returning tabs to format code.
public function makelinks ($urls_data) {
...code...
$i = 5;
$tabs = $this->echo_tabs($i);
$output = "$tabs<ul class=\"url_list\">\n";
...code...
}
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?