why this script dont work? (the right place)
Posted: Sat May 25, 2002 9:29 am
i use 2 txt files , wanna asing 1 lines of txt1 to fist line of txt 2.
place.txt is as folow:
a
b
c
destination.txt is as folow:
brussels
paris
madrid
this the code i think should work:
<?php
$i= 0;
$fd = fopen ("place.txt", "r");
while (!feof ($fd)) {
$location[$i] = fgets($fd, 4096);
$i++;
}
$i= 0;
fclose ($fd);
$fd = fopen ("destination.txt", "r");
while (!feof ($fd)) {
$place[$i] = fgets($fd, 4096);
$i++;
}
fclose ($fd);
$result_des = array($location[0] => $place[0] , $location[1] => $place[1] ) ;
echo "The first line destination is {$result_des["a"]}.";
?>
result should be brussels
thanx for helping
place.txt is as folow:
a
b
c
destination.txt is as folow:
brussels
paris
madrid
this the code i think should work:
<?php
$i= 0;
$fd = fopen ("place.txt", "r");
while (!feof ($fd)) {
$location[$i] = fgets($fd, 4096);
$i++;
}
$i= 0;
fclose ($fd);
$fd = fopen ("destination.txt", "r");
while (!feof ($fd)) {
$place[$i] = fgets($fd, 4096);
$i++;
}
fclose ($fd);
$result_des = array($location[0] => $place[0] , $location[1] => $place[1] ) ;
echo "The first line destination is {$result_des["a"]}.";
?>
result should be brussels
thanx for helping