473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using ReflectionParameter in PHP5

Hello!

I want to get the parameters of an internal php function and have tried
to use the new reflection classes introduced in PHP5. This is what I've
done:

<?php

$funcArr = get_defined_functions();

echo $funcArr["internal"][5] . "\r";

$ref = new ReflectionFunction($funcArr["internal"][5]);

echo $ref;

foreach ($ref->getParameters() as $i => $param)
{
printf("-- Parameter #%d: %s \n" $i, $param->getName());
}

?>

this outputs:

strcmp Function [ public function strcmp ] { }

that output is only done by the two echo:s. There is nothing outputed
by the foreach loop.

Thanks in advance!

Jul 17 '05 #1
3 1766
Lucius wrote:
I want to get the parameters of an internal php function and have
tried to use the new reflection classes introduced in PHP5. This is
what I've done: [...] this outputs:

strcmp Function [ public function strcmp ] { }

that output is only done by the two echo:s. There is nothing outputed
by the foreach loop.


I don't think you can reverse-engineer native functions with the
ReflectionFunction class, only user-defined:

function foo($name, $bla) {}

$ref = new ReflectionFunction("foo");

foreach ($ref->getParameters() as $i => $param) {
printf("-- Parameter #%d: %s \n", $i, $param->getName());
}
JW

Jul 17 '05 #2
Hello!

That's sad =( I though you could because in the PHP5 Power Programming
book they do: ReflectionClass::export("ReflectionParameter");

I am working on a simple phpeditor know of any other way to
automatically get information (name, returntype, description,
parametersname and returntype)? I am going to add it to an XML file. I
guess I'll have to do it by hand then.

Jul 17 '05 #3
use the documentation on php.net? getting the .html files from there or
something should be the second easiest way I suppose.

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Rob Ristroph | last post by:
I have tried out PHP 5 for the first time (with assistance from this group -- thanks!). The people I was working with have a site that uses lots of php objects. They are having problems with...
4
by: badbetty | last post by:
Dear Googlers I have installed PHP5 to run on WinXP against Apache 2. It works! ie. I have tested a few simple scripts and a basic xml document parse. I now want to try the XSL extension so I...
5
by: Aziz | last post by:
Hi, I've recently contacted technical service of a web hosting company and asked them wheter or not they're gonna upgrade to PHP5 and MySQL5. Here's a quote from their response which confused me...
4
by: Chuck Anderson | last post by:
I am trying to install Php5 on my WindowsXP machine (at home, not on the 'net). I downloaded the Php Windows binary at php.net, unzipped it to c:/Php5, changed my Apache config file to use Php5...
0
by: cty | last post by:
Title: Problem in session using php5 Good day, I use php5+mySQL4+IIS5.x Previuosly i use php4 and no error occur,
19
by: McKirahan | last post by:
I am working in two environments neither configuration of which I can change; one's my Web host the other a client. My Web host requires the use of the ".php5" extension to use PHP v5.1.4; where...
3
by: xhe | last post by:
I have just upgraded my php version form php4 to php5. and I met this problem, and don't know if you know the solution. My site was written in PHP4, and most parts can be running smoothly in PHP5,...
8
by: FFMG | last post by:
Hi, I am slowly moving my code to php5. But I would like to make it backward compatible in case something bad happens, (and to make sure I understand what the changes are). The way the...
5
by: simon m | last post by:
Hi All, I have a script sitting on my web server called auto_mail.php5. I would like this to be used two different ways. One way would be for a web form to call it as submit action on a form. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.