Handle real-time cited thread scripts for your PHP

Source: Internet
Author: User

This article is proposed by Dustin Schneider
In response to Stefano Locati's "How To quote your php category", I created a fast and simple php processing thread that will conform to the syntax of other php3 files and create some basic files.
This advantage is that it can be replaced by any annotation-Plus it Is Very extensible.

Currently, the processing thread recognizes the following commands:
= Header (title)
% = Description)
!! = Horizontal Line (Horizontal Line)
; = End of decleration. (End Declaration)

For example:
/* @ This_function ($ var1, $ var2 );
% This function takes 2 variables and does absolutely nothing with them .;
!! */

Something like this will be generated:

This_function ($ var1, $ var2)

Note: This function has variables $ var1 and $ var2. This function has two variables and has no effect on them (here it is a 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"";
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.