Returning a variable from a function in php (return not working)

后端 未结 7 2031
旧时难觅i
旧时难觅i 2021-01-02 18:46

I\'m building an XML page inside of a function, and for some strange reason I don\'t get the whole thing spit out of the function. I\'ve tried

return $thisX         


        
相关标签:
7条回答
  • 2021-01-02 19:29

    You have to call the function and apply echo on the returned value:

     $thisXml = '…';
     echo getThisXML($thisXml);
    

    Or you pass the variably by reference.

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