What are the contents of output.txt after the following code snippet is run?
<?php $str = ‘abcdefghijklmnop’; $fp = fopen(“output.txt”, ‘w’); for($i=0; $i< 4; $i++) { fwrite($fp, $str, $i); } ?>
The correct answer is C. On the first iteration, $i is 0, so no data is written. On the second iteration $i is 1, so a is written. On the third, ab is written, and on the fourth abc is written.Taken together, these are aababc.