title: Read file content and store as an array
body: <p>I want to read log from a file and display it as a list in my Admin panel. I was pretty much sure that this code should work, but apparently it doesn't. The loop doesn't print anything in the list, and the two lines above the loop print just the first line in the file. I guess the problem is in my construction of the array <code>log</code>. Since this project is my first time use of PHP (usually I work with C), don't judge. </p>
  
  <pre><code>&lt;select name=servers size=50 style=width:1028px&gt;
  &lt;?php
    $start="0";
    $start=$_POST['start'];
  
    if ($start=="1") {
     //start the server, this works.
    }
    elseif ($start=="2") {
      $log=fopen("file.log", "r");
      $asdf = sprintf ("&lt;option &gt;%s&lt;/option&gt;", $log);
      echo $asdf; //these two lines are for testing purposes,
         //they print only one line of the file in the list. 
  
      $i=0;
      while ($log[$i]!=null) {
        $asdf[$i] = sprintf ("&lt;option &gt;%s&lt;/option&gt;", $log[$i]);
        echo $asdf[$i];
        $i++; //this loop is the problem, doesn't print anything.
      }
      echo fread($log,filesize("file.log"));
      echo $log;
    }
  ?&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>