Stripping out numerical array keys from var_export
You have to set the second parameter of var_export
to true
, or else there is no return value given to your preg_replace
call.
Reference: https://php.net/manual/function.var-export.php
return
If used and set to TRUE, var_export() will return the variable representation instead of outputting it.
Update: Looking back on this question, I have a hunch, a simple array_values($input)
would have been enough.