The simplest way to debug our php code is to write the data to a log file.
For example, this code prints an array to a text file....
<?php
$myFile = "logFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = '';
foreach($elem as $k=>$v)
$stringData .= $k.'=>'.$v."\n";
fwrite($fh, $stringData);
fclose($fh);
?>
Dont forget to view the file in its stored location...
For example, this code prints an array to a text file....
<?php
$myFile = "logFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = '';
foreach($elem as $k=>$v)
$stringData .= $k.'=>'.$v."\n";
fwrite($fh, $stringData);
fclose($fh);
?>
Dont forget to view the file in its stored location...
Comments
Post a Comment