This article was submitted by: Dustin Schneider
In response to Stefano Locati's "How to reference your php classes", I created a quick and simple php processing thread that will conform to the syntax of other php3 files and create some basic files.
The advantage of this is that it can be replaced by any annotation - plus it is very extensible.
The current processing thread recognizes the following commands:
@@ = Header (Title)
%% = Description (narration)
!! = Horizontal Line (horizontal line)
; = End of decleration. (End Announcement)
For example:
/* @@this_function($var1, $var2);
%%This function takes 2 variables and does absolutely nothing with them.;
!! */
will produce something like this :
this_function($var1, $var2)
Description: This function has variables $var1 and $var2 Description: This function has two variables and has no effect on them (here is Horizontal line)
$filename = "FILENAME_HERE";
$fp = fopen($filename, "r");
$buffer = fread($fp, filesize($filename) );
fclose($fp);
for($i=0; $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 "
";
}
}