Application Architecture : Miscellaneous
Document your PHP scripts Realtime
Submitted By: Dustin SchneiderDate: 08/29/00 17:08
In response to Stefano Locati's "How to Document Your PHP classes", I created a quick & simple PHP script which will parse other PHP3 files and create some basic documentation. The advantage to this is, it can be placed under any comment -- plus it's very extendable. The current scripts recognises these commands:
@@ = Header %% = Description !! = Horizontal Line ; = End of decleration.
For example:
/* @@this_function($var1, $var2); %%This function takes 2 variables and does absolutely nothing with them.; !! */
Would produce something like this:
this_function($var1, $var2)
Description: This function takes 2 variables and does absolutely nothing with them.(horizontal line here)
$filename = "FILENAME_HERE";
$fp = fopen($filename, "r");
$buffer = fread($fp, filesize($filename));
fclose($fp);
for($i=0; $i<strlen($buffer); $i++)
{
// Header
if ($buffer[$i] == '@' && $buffer[$i+1] == '@')
{
echo "";
$i++;
while($buffer[$i++] != ';')
{
if ($buffer[$i] == ';')
break;
echo $buffer[$i];
}
echo "
";
}
// Description
if ($buffer[$i] == '%' && $buffer[$i+1] == '%')
{
echo "Description: ";
$i++;
while($buffer[$i++] != ';')
{
if ($buffer[$i] == ';')
break;
echo $buffer[$i];
}
echo "
";
}
if ($buffer[$i] == '!' && $buffer[$i+1] == '!')
{
echo "<hr></hr>";
}
}
Dustin Schneider
| Comments: | ||
| No RegExp ? | HuzursuZ | 09/04/03 15:19 |
| Also check out phpxref | George Herson | 09/18/00 10:54 |
| RE: JavaDoc style | Dustin Schneider | 09/14/00 20:28 |
| JavaDoc style comments | Joshua Eichorn | 09/13/00 03:19 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||

