Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array trouble... 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
if you are using the following..

$fcontents = file($filename)

how do you access the array using subscripts????

i.e. $fcontents[0]

cheers

fyl
 
while (list ($line_num, $line) = each ($fcontent)) {

printf("$line");

} ***************************************
Party on, dudes!
[cannon]
 
we are attempting to edit web-pages on the fly searching for individual HTML tags (<!enterlink>).

we have used the code you suggest in the following format

$x=0;
while(list($line_num,$tarray[$x])= each($fcontents))
{
if ($tarray[$x] = &quot;<!enterlink>&quot;) print $x;
$x++;
}

Even though the tag comment does exist in the file it seems unable to find it...

cheers

FYL
 
OK heres a short page to get you in the right direction

call the page and give a page to search and search string in the URL e.g
--------------search.php
<?php

$fcontent = file($file);
echo &quot;File : $file<br>&quot;;
echo &quot;<textarea cols=80 rows=30>&quot;;
while (list ($line_num, $line) = each ($fcontent)) {

if (eregi($search,$line))
{

echo &quot;$line&quot;;

}
}
echo &quot;</textarea>&quot;;

?> ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top