Why do print_r and var_dump execute before echo

后端 未结 3 398
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 01:52

I\'m calling either var_dump() or print_r() on an array that has one value in an echo statement:

echo \"
<
3条回答
  •  渐次进展
    2020-12-12 02:33

    They do it because they aren't returning data, they are echoing. You can do print_r($array, true) to make it return, but var_dump() will need output buffering.

    If you want it to work the way you're trying to make it, separate them into distinct calls.

提交回复
热议问题