Page 1 of 1

Function prototypes in XML format?

Posted: Fri Jan 25, 2008 7:36 am
by mattcooper
Hi all,

Don't ask why I want this... :) Does anyone know if the function prototypes from the manual have ever been put in XML format? Something like:

Code: Select all

 
<php-prototypes>
    <functions category="string functions">
        <function name="strip_tags">
            <prototype>
                <!-- string string strip_tags  ( string $str  [, string $allowable_tags  ] ) -->
                <function max-num-args="2" />
                <args>
                    <arg type="string" optional="false">$str</arg>
                    <arg type="string" optional="true">$allowable_tags</arg>
                </args>
                <return type="string" />
            </prototype>
        </function>
    </functions>
    <functions category="array functions">
        <function name="array_push">
            <prototype>
                <!-- int array_push  ( array &$array  , mixed $var  [, mixed $...  ] ) -->
                <function max-num-args="3" />
                <args>
                    <arg type="array" optional="false">$array</arg>
                    <arg type="mixed" optional="false">$var</arg>
                    <arg type="mixed" optional="true">$...</arg>
                </args>
                <return type="int" />
            </prototype>
        </function>
    </functions>
</php-prototypes>
 
This is for a huge project I'm scoping out at the moment and it won't really be possible in terms of time to actually do it myself :(

Any pointers and suggestions gratefully received, as always.

Re: Function prototypes in XML format?

Posted: Fri Jan 25, 2008 10:49 am
by Christopher
One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.

Re: Function prototypes in XML format?

Posted: Fri Jan 25, 2008 11:20 am
by mattcooper
arborint wrote:One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.
Lulz :D Oh well, if you do recall sometime, let me know! Ta... rofl

Re: Function prototypes in XML format?

Posted: Fri Jan 25, 2008 5:12 pm
by Ambush Commander
Yes, indeed there is, although you'll need to do a bit of processing to get it into the form you gave us. PHP's documentation uses Docbook 5's function documentation syntax.

Some examples can be found here: array_change_key_case()
and so forth at http://cvs.php.net/viewvc.cgi/phpdoc/

Re: Function prototypes in XML format?

Posted: Fri Jan 25, 2008 7:43 pm
by Ollie Saunders
You might find the various methods of ReflectionParameter and ReflectionFunction a useful guide.

Re: Function prototypes in XML format?

Posted: Sat Jan 26, 2008 3:22 am
by Chris Corbyn
arborint wrote:One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.
It's ThePhoenix ;)

It's actually really easy to "rip" the manual in any format you like though. Download, the HTML version is multiple files, then rip away... all the pages follow the same conventions so even simple regex works well. I've done it before but I don't have the code.

I ripped all the functions along with their synopses so that when you rolled over a function in a

Code: Select all

 block here on the forum you got a link to the manual, and a tooltip showing the function synopsis.