To use the PHP Inspection Unit in your Application you must add the Unit to your uses-List.
Example:
If your uses-list looks like this:
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;
Change it into:
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
uPHPInspector;
The TPHPSource class, that is inside the unit, provides all required
functionality.
Example:
var
MySource: TPHPSource;
I: Integer;
begin
MySource := TPHPSource.Create(SomeString);
try
ShowMessage('There are ' + IntToStr(MySource.ClassCount) + ' classes in the text!');
// Enumerate all classes and display their names!
for i := 0 to MySource.ClassCount-1 do
begin
ShowMessage(MySource.Classes[i].Name);
end;
finally
MySource.Free;
end;
end;
The Variable SomeString (which is a string) contains the supplied PHP source text.
You could also use Memo1.Text or any other string-variable or -constant.
You may also set a new source text by using the SourceText property of the TPHPSource class.
Note: You can download an extended sample application from the PHP Inspection Unit homepage.
Credits and Licence