PHP: return value from function and echo it directly?

前端 未结 7 1560
遇见更好的自我
遇见更好的自我 2020-12-31 05:44

this might be a stupid question but …

php

function get_info() {
    $something = \"test\";
    return $something;
}
<
相关标签:
7条回答
  • 2020-12-31 06:44

    You can use the special tags:

    <?= get_info(); ?>
    

    Or, of course, you can have your function echo the value:

    function get_info() {
        $something = "test";
        echo $something;
    }
    
    0 讨论(0)
提交回复
热议问题