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.
$my_string = 'My String';
do_action( 'php_console_log', $my_string );
$my_array = array(
'elm 1'
'elm 2',
);
do_action( 'php_console_log', $my_array );
$my_array = array(
'key 1'=>'elm 1',
'key 2'=>'elm 2',
);
do_action( 'php_console_log', $my_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);