print object methods if object is feeded to sm_print_r
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 2 Mar 2005 18:19:46 +0000 (18:19 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 2 Mar 2005 18:19:46 +0000 (18:19 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8929 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/strings.php

index 3c04d73ce6dbcfa539e93c81e79750b2643f0af2..aba2bfd43b6f513b901204e0d7827b863b0ac24b 100644 (file)
@@ -867,6 +867,19 @@ function sm_print_r() {
     foreach(func_get_args() as $var) {
         print_r($var);
         echo "\n";
     foreach(func_get_args() as $var) {
         print_r($var);
         echo "\n";
+        // php has get_class_methods function that can print class methods
+        if (is_object($var)) {
+            // get class methods if $var is object
+            $aMethods=get_class_methods(get_class($var));
+            // make sure that array is not empty
+            if ($aMethods!=array()) {
+                echo "Object methods:\n";
+                foreach($aMethods as $method) {
+                    echo '* ' . $method . "\n";
+                }
+            }
+            echo "\n";
+        }
     }
     $buffer = ob_get_contents(); // Grab the print_r output
     ob_end_clean();  // Silently discard the output & stop buffering
     }
     $buffer = ob_get_contents(); // Grab the print_r output
     ob_end_clean();  // Silently discard the output & stop buffering