PHP Console Log

plugin banner

Log PHP variables and arrays to the web console in your browser via JavaScript's console.log(). No browser extensions required.

Author:Marcus Viar (profile at wordpress.org)
WordPress version required:4.4
WordPress version tested:5.3.3
Plugin version:1.0.1
Added to WordPress repository:10-07-2019
Last updated:07-02-2020
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:1
Plugin URI:https://marcusviar.com/php-console-log
Total downloads:1 962
Active installs:40+
plugin download
Click to start download

Examples

Place the do_action( ‘php_console_log’, ‘My String or Array’ ); function anywhere in your WordPress plugin PHP code. The value(s) you pass into do_action( ‘php_console_log’, ‘My String or Array’ ); will be logged to the web console in your browser.

Pass in a string

$my_string = 'My String';
do_action( 'php_console_log', $my_string );

Pass in an array

$my_array = array(
    'elm 1'
    'elm 2',
);
do_action( 'php_console_log', $my_array );

Pass in an associative array

$my_array = array(
    'key 1'=>'elm 1',
    'key 2'=>'elm 2',
);
do_action( 'php_console_log', $my_array);

Pass in an unlimited number of arguments nested to an unlimited depth (multi-dimensional array)

$my_array = array(
    'My String 1',
    'My String 2',
    array(
        'elm 1',
        'elm 2',
    ),
    'My String 3',
    array(
        'key 1'=>'elm 1',
        'key 2'=>'elm 2',
        'key 3' => array(
            'key 3a' => 'elm 3a',
            'key 3b' => 'elm 3b',
        ),
    ),
    'My String 4'
);
do_action( 'php_console_log', $my_array);

Screenshots
FAQ
ChangeLog