PHP Array to String equivalent

后端 未结 1 864
误落风尘
误落风尘 2020-12-10 17:55

I\'m wondering if anyone has a recursive solution to converting an array to a string.

Here\'s what I mean:

An array $args that has the following

相关标签:
1条回答
  • 2020-12-10 18:53

    Looks like you are after

    • var_export — Outputs or returns a parsable string representation of a variable

    That won't give you $hello though, because $hello cannot be in an array. It's always just the value of the variable, not the variable name. If you want '$hello', put it into single quotes when inserting it to the array, e.g. insert it as a string, not as a variable.

    0 讨论(0)
提交回复
热议问题