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

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.

how is xdebug?

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();
}
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.