hello, hope you can help me out... i've got the following code to display a list of recent searches: function display_table(){ $content = file("list.txt"); $return = '<p>'; $lines = count($content); for($i=0;$i<$lines;$i++){ $return .= $content[$i]; if($i == $lines - 1){ }else{ $return .= " "; } } $return .= "</p>"; return $return; } PHP: but you'll see on the 4th line down where the new line starts, it indents it with 5 spaces. how can i change the code so it does separate search terms with 5 spaces, but not include the 5 spaces in the beginning of a new line? as always, much appreciated!
function display_table() { $content = file("list.txt"); $return = '<p>'; $lines = count($content); $i = 0; while($i < $lines) { $return .= $contents[$i]; if($i != $lines - 1) $return .= " "; $i++; } $return .= "</p>"; return $return; } PHP: try this mate... not so sure, just try this...
function display_table(){ $content = file("list.txt"); $return = '<p>'; $lines = count($content); for($i=0;$i<$lines;$i++){ $return .= '<div style="display: inline; margin-right: 10px;">'; $return .= $content[$i]; if($i == $lines - 1){ }else{ $return .= "</div>"; } } $return .= "</p>"; return $return; } Code (markup): Something like that would probably work better. If not, let me know, I'll rewrite that function for you.