Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<!- - TASK -- Write your PHP code in in the space provided below . --> <div clas

ID: 3591135 • Letter: #

Question

<!-- TASK -- Write your PHP code in in the space provided below.   -->

<div class="task">
<h2> Task : Files, arrays, and for-loops </h2>
<p> This task is to read in the contents of the file <code>List.txt</code> in to PHP. Then, you should print out each line
      from the file as a paragraph element. If the line contains the string "ENG", print this out using highlight.
        </p>

<div class="output">
      <?php
        /* Task 3: Put your code here */
        ?>
     </div>
</div>

Explanation / Answer

$file_handle = fopen("code", "r");

while (!feof($file_handle)) {

   $line = fgets($file_handle);

if(strpos($line,'ENG')){
  highlight_string($line);
}

else{

   echo $line;
}

}

fclose($file_handle);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote