I have a txt file.
source.txt:
test.com,Test
www.cnn.com,CNN
twitter.com,Twitter
I want to print it like
Output:
<a target="_blank" href="http://test.com">Test</a>
<a target="_blank" href="http://www.cnn.com">CNN</a>
<a target="_blank" href="http://twitter.com">Twitter</a>
My code doesn't work:
$array = explode("
", file_get_contents('/home/source.txt'));
echo '<a target="_blank" href="http://' . $array[0] . '">'. $array[1] . '</a>'