Re: Got a problem I cant figure out
| From: | Dan Koken | Date: | Mon, 28 Jan 2002 08:20:15 +0000 |
| Subject: | Re: Got a problem I cant figure out | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82407@lists.php.net to get a copy of this message | ||
Could be that you have a open curly bracket somewhere.
Here is a quick program I use to beautify and clean up my PHP code and to point out any open brackets;
HTH .. Dan
<?
/* ----------------------------------------- *\
** Beauty: cleans up source PHP code and
** nest everything
\* ----------------------------------------- */
$file_name = "?????.php"; // gimme your file name
$data = file("c:/temp/$file_name"); // gimme your in location
$fp = fopen("c:/temp/$file_name",'w');// gimme your out location
$sho_nst = "N"; // set [Y] to see nest count
$cmt = 0; // start comment count
$nst = 0; // start nesting count
$i = 0; // count for input array
while (isset($data[$i])) { // while going through the data
if (strstr($data[$i],"/*")) $cmt++; // don't count If comments Start
if (strstr($data[$i],"*/")) $cmt--; // Count again if comments end
if (($cmt < 1) && (strstr($data[$i],"{"))) $nst++; // count number of begin nesting
$x = ''; // init the output file line
for ($j = 0; $j < $nst; $j++) { // according to nestings
$x .= "\t"; // put tabs on
} // end for
$y = ltrim($data[$i]);
if (empty($y)) $y = "\n";
$out = $x . $y; // strip leading junk and put tabs on
if (($cmt < 1) && (strstr($data[$i],"}"))) $nst--; // un count number of end nesting
if ($sho_nst == 'Y') $out = $i . "|" . $cmt . "|" . $nst . "|" . "$out";
fwrite ($fp, $out); // put it to the output file
echo "$i | $cmt | $nst | $out <BR>"; // lemme see it in the browser
$i++; // bump count for input array
} // end while
fclose($fp); // close the output file
?>
Ben Turner wrote:
Parse error: parse error in /var/www/docs/tacklebox/404handler.php on line 47 I am receiving this error on my page but the problem is that line 47 is the ?> and last line of the page. Is their something Im missing here?? Thanks, Ben