3 ms·
This non working prototype code is bothering me....fixed. <?php # considering t2.txt contains below two lines #a c d f n z r #granc dr ssdo and # $file_li
by cdevs 10y ago
This non working prototype code is bothering me....fixed.
<?php
# considering t2.txt contains below two lines
#a c d f n z r
#granc dr ssdo and
#
$file_lines = file_get_contents('./t2.txt');
$split_by_line = explode("\n",$file_lines);
$circular = array();
foreach ($split_by_line as $line) {
$split_by_words = explode(' ',$line);
sort($split_by_words);
$circular = $split_by_words;
foreach($split_by_words as $word){
array_push($circular,array_shift($circular));
echo implode($circular," ") . "\n";
}
$split_by_words = null;
echo "\n";
}
- Jtsummers 10y agoPrefix your code with two spaces on each line and HN will include it verbatim. Otherwise it thinks you have paragraphs with line breaks that it ignores.