N
N
NubasLol2020-08-07 14:16:31
symfony
NubasLol, 2020-08-07 14:16:31

How to write the result of dd() to a variable?

I want to display the contents of the variable beautifully, passing it to html via api. I want the same html as dd does.

How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Flying, 2020-08-07
@NubasLol

dd()is just a wrapper over the VarDumper::dump(), so the source of this html is obvious to you.
Any capture of output in PHP is done through the output buffering control .

N
Nikita Pushkar, 2020-08-07
@NickPush

Symphony also has dump($yourVar).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question