There are lots of questions and answers around the subject of valid php syntax from var outputs, what I am looking for is a quick and clean way of getting the output of
For anyone looking for a more modern-day solution, use the Symfony var-exporter, also available as a standalone library on composer, but included in Symfony default.
composer require symfony/var-exporter
use Symfony\Component\VarExporter\VarExporter;
// ...
echo VarExporter::export($arr)