problem with strings .
Posted: Mon Feb 25, 2008 11:34 am
hey, I'm trying to create a code that separates 2 strings by the space between them. the code loads a text file line by line -
every line contains First name and Last name, examples:
Lynne Bonnett
Wilson Hulsey
I want the output to be like this =
First name: Lynne
Last name: Bonnett
Code: Select all
<?php
$names = "names.txt";
$fh = fopen($names, 'r');
$lines = file($names);
$count = count($lines);
echo "$count names found\n\r";
for ($i=1; $i<=$count; $i++)
{
$theData = fgets($fh);
echo $data;
}
fclose($fh);
?>
Lynne Bonnett
Wilson Hulsey
I want the output to be like this =
First name: Lynne
Last name: Bonnett