From 3896acce785a7599ed389fe4f0374d22fdbb74f9 Mon Sep 17 00:00:00 2001 From: tokul Date: Wed, 2 Mar 2005 18:19:46 +0000 Subject: [PATCH] print object methods if object is feeded to sm_print_r git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8929 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/strings.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/functions/strings.php b/functions/strings.php index 3c04d73c..aba2bfd4 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -867,6 +867,19 @@ function sm_print_r() { 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 -- 2.25.1