Reputation: 29
so my words is below, separated by space. my code is 1st line is grabbed from text file & whole line is echoed, instead i need each-word as ordered list.
• bombay new_delhi chennai culcutta
<?php
$z = file('q1.txt'); echo $z[1]; echo (mt_rand(1,9));
$st = array($z[1]);
foreach($st as $ls) {echo " <li>$ls</li>\n";}
i need like this
• bombay
• new_delhi
• chennai
• culcutta
Upvotes: 0
Views: 445
Reputation: 16
$var = file('q1.txt');
$abc = explode(' ', $var);
echo '<ul style=" list-style-type: circle;">';
foreach($abc as $value){
echo " <li>$value</li>";
}
echo '</ul>';
Upvotes: 0
Reputation: 29
<?php
$z = file('q1.txt'); echo $z[1]; echo (mt_rand(1,9));
$c= explode(" ", $z[1]);
echo '<ol>';
foreach($c as $w) {echo " <li>$w</li>\n";}
echo '</ol>';
Upvotes: 0