json_encode
symfony/var-dumper
Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Returns the JSON representation of a value
json_encode
(
mixed $value
,
int $flags
=
0
,
int $depth
=
512
):
string
|
false
return
$this
->
dumpHeader
;
}
$line
=
str_replace
(
'{$options}'
,
json_encode
(
$this
->
displayOptions
,
\JSON_FORCE_OBJECT
), <<<'EOHTML'
<script>
Sfdump = window.Sfdump || (function (doc) {
Dumper/HtmlDumper.php
}
if (
'const'
===
$style
&& isset(
$attr
[
'value'
])) {
$style
.=
sprintf
(
' title="%s"'
,
esc
(
is_scalar
(
$attr
[
'value'
]) ?
$attr
[
'value'
] :
json_encode
(
$attr
[
'value'
])));
} elseif (
'public'
===
$style
) {
$style
.=
sprintf
(
' title="%s"'
, empty(
$attr
[
'dynamic'
]) ?
'Public property'
:
'Runtime added dynamic property'
);
} elseif (
'str'
===
$style
&&
1
<
$attr
[
'length'
]) {
Dumper/HtmlDumper.php
if (-
1
===
$depth
) {
$args
= [
'"'
.
$this
->
dumpId
.
'"'
];
if (
$this
->
extraDisplayOptions
) {
$args
[] =
json_encode
(
$this
->
extraDisplayOptions
,
\JSON_FORCE_OBJECT
);
}
$this
->
line
.=
sprintf
(
str_replace
(
'"%s"'
,
'%s'
,
$this
->
dumpSuffix
),
implode
(
', '
,
$args
));
Dumper/HtmlDumper.php