How to: console.log in PHP

Outputting to your shell or terminal to inform the user of the outcome of a program or valuable debugging information is an essential of every programming language.

JavaScript

In JavaScript console.log will print to the browser console or your shell where node.js is running your file:

// strings
console.log('Hello World!');
// multiple parameters
console.log('Hello', 'World!', 666);

More console.log References

PHP

In PHP you can print to the terminal or the log by using var_dump:

<?php
$a = array(1, 2, array("a", "b", "c"));
var_dump($a);
?>

More var_dump References