Viewing 4 replies - 1 through 4 (of 4 total)
  • Or this way:

    if ( ! is_scalar( $value ) ) {
    	echo '<li>' . $key . ' => <ol><li><xmp>';
    	print_r( $value );
    	echo '</xmp></li></ol></li>';
    }
    else {
    	echo '<li>' . $key . ' => ' . $value . '</li>';
    }

    Or more useful, use print_r?

    if ( is_object( $value ) ) {
    	echo '<li>' . $key . ' => <ol>';
    	foreach ( $value as $_key => $_value )
    		echo '<li>' . $_key . ' => ' . $_value . '</li>';
    	echo '</ol></li>';
    } else {
    	echo '<li>' . $key . ' => ' . print_r( $value, true ). '</li>';
    }

    @ben Huson:
    I have print_r in my second example, when it’s not a scalar, and surrounded by <xmp> (which is a better version of

    )

    Sorry, missed that – I was obviously skim reading too fast ??
    Use of is_scaler() makes sense.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Quick fix] Debug_Bar_WP_Query::render array to string notice’ is closed to new replies.