0

Am running a script that checks every line in a foreach loop. I would like help in how to tackle this each execution needs to be written to a log file which will show how log it went to process the each line at a time and if there is an error it will break the loop and display the log file.

I was thinking of a try catch or is there a class I can try thanks

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by pritaeas
0

You can write the log to file (personally I like log4php), but you could also keep it in memory and output it only if there is a problem. Depends on whether or not you want to keep the log files for a longer period.

0

I would like to use that to record my loop and write to a file. Did something really simple. Any tips

<?php
$names=array('','John','Scott');

foreach($names as $person){
if($person==""){
xdebug_break();
}
}
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.