andtags. - * + * The output is wrapped in <
> and <> tags. + * Since 1.4.2 accepts unlimited number of arguments. + * @since 1.4.1 * @return void */ function sm_print_r() { @@ -533,13 +851,442 @@ 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 $aMethods is array and array is not empty + if (is_array($aMethods) && $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 - print '
'; + print ''; +} + +/** + * version of fwrite which checks for failure + * @param resource $fp + * @param string $string + * @return number of written bytes. false on failure + * @since 1.4.3 + */ +function sq_fwrite($fp, $string) { + // write to file + $count = @fwrite($fp,$string); + // the number of bytes written should be the length of the string + if($count != strlen($string)) { + return FALSE; + } + + return $count; +} + +/** + * sq_get_html_translation_table + * + * Returns the translation table used by sq_htmlentities() + * + * @param integer $table html translation table. Possible values (without quotes): + *'; print htmlentities($buffer); - print ''; + print '