Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions en/core-libraries/global-constants-and-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,37 @@ such as debugging and translating content.

.. php:function:: debug(mixed $var, boolean $showHtml = null, $showFrom = true)

.. versionadded:: 3.3.0
Calling this method will return passed ``$var``, so that you can, for instance,
place it in return statements.

If the core ``$debug`` variable is ``true``, ``$var`` is printed out.
If ``$showHTML`` is ``true`` or left as ``null``, the data is rendered to be
browser-friendly.
If ``$showFrom`` is not set to ``false``, the debug output will start with the line from
which it was called.
Also see :doc:`/development/debugging`

.. php:function:: pr(mixed $var)

.. versionadded:: 3.3.0
Calling this method will return passed ``$var``, so that you can, for instance,
place it in return statements.

Convenience wrapper for ``print_r()``, with the addition of
wrapping ``<pre>`` tags around the output.

.. php:function:: pj(mixed $var)

.. versionadded:: 3.3.0
Calling this method will return passed ``$var``, so that you can, for instance,
place it in return statements.

JSON pretty print convenience function, with the addition of
wrapping ``<pre>`` tags around the output.

It is meant for debugging the JSON representation of objects and arrays.

.. php:function:: env(string $key, string $default = null)

.. versionadded:: 3.1.1
Expand Down Expand Up @@ -135,18 +159,6 @@ such as debugging and translating content.

Commonly used like ``list($namespace, $className) = namespaceSplit('Cake\Core\App');``

.. php:function:: pr(mixed $var)

Convenience wrapper for ``print_r()``, with the addition of
wrapping ``<pre>`` tags around the output.

.. php:function:: pj(mixed $var)

JSON pretty print convenience function, with the addition of
wrapping ``<pre>`` tags around the output.

It is meant for debugging the JSON representation of objects and arrays.

Core Definition Constants
=========================

Expand Down