xml - Make Php string without break lines -
i need generate random sentences dictionary. in dictionary every word @ 1 line, firstly load dictionary array , after have cycle , randomly pickup data, if wrote it, @ 1 line in browser, in source code every word @ line. need create set of xml files search engine , new lines indexed /n/r
, in xml source code has got symbol 
question how can make sentence @ 1 line in source code too. thanks.
here piece of code don´t have here randomly loading data, made illustration in cycle.
$file = fopen("test.txt", "r"); $data = array(); while (($buffer = fgets($file)) !== false) { $data[] = $buffer; } $sentence = ''; ($i=0;$i<10;$i++){ $sentence = $sentence . $data[$i]; }
use trim function filter new line characters. in code use:
$data[] = trim($buffer);
Comments
Post a Comment