skip line begin with #

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • ogo796
    replied
    $found = "#"; // need to be serch
    $lines = file.txt; //text file
    if ($lines)

    {

    foreach($lines as $lineNumber) //loop throuhg line by line

    {

    $foundAMatch = preg_match("^$f ound", $lineNumber, $matches, PREG_OFFSET_CAP TURE);//regular expression to serch

    if ($foundAMatch > 0)

    {

    $found = $matches[0][0];

    $count=$lineNum ber;


    }

    }
    {
    $str_array = explode(" ",$count);

    echo $str_array[0]."<br/>";

    }

    else

    {

    $line="no file/folder found";

    echo $line;

    }

    if you can help me to skip the line beggin with hash cause they always gives me a problem when i read from the file.

    Leave a comment:


  • ronverdonk
    replied
    Show (part of) the reading code, because you can either read a file 'at-once', in an array or line-by-line.

    Ronald

    Leave a comment:


  • ogo796
    started a topic skip line begin with #

    skip line begin with #

    hi all

    i am having a problem with reading the lines from the text file

    my file look like this:

    #"11-02-2008 " chief vs tumi "1234"
    "12-02-2008 " duma vs duma "1254"
    i am wondering if the is any function that will can help me to skip the line begin with hash.
Working...