且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP 数组到字符串等效

更新时间:2023-02-06 18:06:38

看起来你很在意

  • var_export — 输出或返回一个变量的可解析字符串表示

不过这不会给你 $hello,因为 $hello 不能在数组中.它始终只是变量的值,而不是变量名称.如果您想要 '$hello',请在将其插入数组时将其放入单引号中,例如将其作为字符串插入,而不是作为变量插入.

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.