Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

PHP → console.log

Dump PHP variables to the browser console

Installation

Simply download the file and include() it in your project.

Examples

Scalar

php:

$a = 42;
console_log($a);

Browser console output:

scalar example

Map

php:

$b = array( 'foo' => 'some value', 'bar' => [
'baz' => 113,
'qux' => null,
'corge' => [0,1,2] ]
);
console_log($b);

Browser console output:

array example

Object

php:

class SomeObject
{
private$grault;
publicfunction__construct($val)
{
$this->grault = $val;
}
}
class TestClass
{
public$public_var;
private$private_var;
protected$protected_var;
private$object_var;
publicfunction__construct($public, $private, $protected)
{
$this->public_var = $public;
$this->private_var = $private;
$this->protected_var = $protected;
$this->object_var = newSomeObject(42);
}
}
$testClass = newTestClass('public value','private value', 'protected value');
console_log($testClass);

Browser console output:

object example

Multiple

php:

console_log($a, $b, $testClass);

Browser console output:

multiple example

About

log PHP variables to the browser console

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages