Life, the Universe, and Everything: Time Exceeded, PHP

Hi All,

I started programming today and I’ve been trying to google my way through this first easy question, but I can’t seem to get it, any help in the right direction would be great. I seem to get time exceeded, but I’ve tried a few different ways of doing it and seem to be getting wrong answer now.

many thanks,

<?php $line = trim(fgets(STDIN)); while ($line != '42') { fwrite(STDOUT, $line."n"); } ?>

And this one as well

<?php for(; ;) { $line = fgets(STDIN); if ($line='42') { break; } fwrite(STDOUT, $line."n"); } ?>

Okay I managed to pass it in the end, with one of my tries, I had missed the \ before the n in ."\n"

Still not sure why some of my tries have timed out.

//