I'm trying to create unique sentences with randomizer script but the problem is that in the html output, all strings taken randomly from different .txt files are physically displayed on separate lines.
The code I'm using, is:
<?php require('header1.php'); ?> <?php require('header2.php'); ?> <?php require('header3.php'); ?>
<?php echo $header1 . $header2 . $header3 ?>
The code inside the .php files is similar (they just use according .txt files).
Example code of header2.php:
<?php
$textfile ="header2.txt";
$items = file("$textfile");
$item = rand(0, sizeof($items)-1);
$old1 = $items[$item];
$header2 = str_replace('\n', '', $old1);
?>
The contents of .txt files are just strings, each on it's own line.
The output in the browser is : String1 string2 string3
Output in the html is:
String1
string2
string3
There's no visual difference in the browser view but for specific purpose, I need the strings to be displayed all on the same line in html also.
I tried removing possible line breaks from the end of the text strings I pulled from the .txt files (/n) but it made no difference.
Deephouse