Home > Backend Development > PHP Tutorial > Instant quoting for your PHP thread script_PHP Tutorial

Instant quoting for your PHP thread script_PHP Tutorial

WBOY
Release: 2016-07-13 17:24:03
Original
1020 people have browsed it

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 "
";
}
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532184.htmlTechArticleThis article was submitted by: Dustin Schneider in response to Stefano Locati's "How to cite your php categories", I created A fast and simple php processing thread that will conform to the syntax and construction of other php3 files...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template