PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » PHP_Beautifier » Bug #1598

Indent not correct

Details

Submitted2004-06-09 21:33 UTC
Frommarduk at k-d-w dot org
StatusWont fix
PackagePHP_Beautifier
PHP Version5.0.0RC2 (Release Candidate 2)
OSWindowsXP
Roadmaps(Not assigned)

Comments

[2004-06-09 21:33 UTC] marduk at k-d-w dot org

Description:
------------
The un-converted code looks like following:
<code>
<?php
if (isset($_POST["text"])) {
echo "FOTZEEE";
} else {
?>
<form method="post" action="<? echo $_SERVER["PHP_SELF"]; ?>">
<input type="text" name="text" />
<input type="submit" />
</form>
<?
}
?>
</code>
There are always 4 spaces ident in the HTML area

Converted it looks like following:
<code>
<?php
if (isset($_POST["text"])) {
echo "FOTZEEE";
} else {
?>
<form method="post" action="<?php
echo $_SERVER["PHP_SELF"];
?>">
<input type="text" name="text" />
<input type="submit" />
</form>
<?php
}
?>
</code>
There the '?>' tag is always at the beginning of the line.
Because this looks a little bit confusing, I would prefer following output:
<code>
<?php
if (isset($_POST["text"])) {
echo "FOTZEEE";
} else {
?>
<form method="post" action="
<?php
echo $_SERVER["PHP_SELF"];
?>">
<input type="text" name="text" />
<input type="submit" />
</form>
<?php
}
?>
</code>
If the '<?php' and '?>' tags will always be at the beginning of the line I think the code will is easier to read.

[2004-06-10 05:56 UTC] clbustos at entelchile dot net

Not a bug, really, only a 'feature'.
From release 0.0.7, the open and close tag maintain the original whitespace. So
<code>
<?php echo 'hi' ?>
</code>
Remains untouched.