using get_class_methods

Hi all,

First of all - I am REALLY a newbie at PHP - but I do understand programming concepts including OO at a high level … Oracle PL/SQL (the language I have mostly worked with up til now) has the package concept which is in many ways similar to classes.

I want to create a PHP script that calls a MySQL stored procedure. I am pretty sure this will require that I use a method from the database class. Problem is, I don’t know how to find a listing of the methods that are available in this class. On I found a sample script that calls the built-in get_class_methods to display the methods in a user-created class. I stripped out the part of the code that creates a class, because I want to display the methods in a built-in class, not a user-created class, and kept only the part that calls get_class_methods … but nevertheless it is throwing an error !

So here is my code …

<?php global $database ; $class_methods = get_class_methods('database'); foreach ($class_methods as $method_name) { echo "$method_namen"; } ?>

Which generates the following error :

Warning: Invalid argument supplied for foreach() in /home/hart7511/public_html/CCSmallGroups/components/com_fabrik/libs/CCSmallGroups/cc_get_class_methods.php on line 8

Note that if I try declaring method_name it seems to make no difference - unless my declaration syntax is incorrect. But from several examples I have seen, PHP appears to support implicit declaration of variables - am I correct ?

So anyway if someone can tell me what is wrong with this script I’d be really grateful !

Thanks in advance.

Sponsor our Newsletter | Privacy Policy | Terms of Service