I am auto generating some code and using var_export to output an array in a parseable format. Any ideas as to how I might get it to indent so it matches the rest of the output
protected function getCode(){
$rs = ' $this->add(';
$rs .= var_export($this->getArray(),true);
$rs .= ');'.PHP_EOL;
return $rs;
}
The output I get is like
$this->add(array (
'name' => 'notes',
'attributes' =>
array (
'label' => 'Date',
'label_attributes' =>
array (
'class' => 'col-md-4 control-label',
),
),
));
I would like it to be with correct white space
$this->add(array (
'name' => 'notes',
'attributes' =>
array (
'label' => 'Date',
'label_attributes' =>
array (
'class' => 'col-md-4 control-label',
),
),
));