38443-vm/check_divs.php
2026-02-20 23:46:55 +00:00

20 lines
611 B
PHP

<?php
$content = file_get_contents('index.php');
$open = substr_count($content, '<div');
$close = substr_count($content, '</div');
echo "Open: $open, Close: $close\n";
// Trace where it goes wrong
$lines = explode("\n", $content);
$depth = 0;
foreach ($lines as $i => $line) {
$line_open = substr_count($line, '<div');
$line_close = substr_count($line, '</div');
$old_depth = $depth;
$depth += $line_open - $line_close;
if (($i + 1) >= 760 && ($i + 1) <= 780) {
echo "Line " . ($i + 1) . ": Depth $old_depth -> $depth | " . trim($line) . "\n";
}
}
echo "Final depth: $depth\n";