BACK TO DIRECTORY

PHP Console Log

by Marcus Viar

5.0
(1 ratings)

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

If PHP Console Log is working and you have not called do_action( 'php_console_log', 'My String or Array' ); you will see a message similar to this in your browsers web console.

If PHP Console Log is working and you have not called do_action( 'php_console_log', 'My String or Array' ); you will see a message similar to this in your browsers web console.

Plugin Details

Active Installs
10
Total Downloads
2,774
Version
1.0.1
Requires WP
4.4
Requires PHP
5.6.20
Tested Up To
5.3.23
Added
2019-07-10
Last Updated
2020-02-07 8:58am GMT

Ratings

5
1
4
0
3
0
2
0
1
0