PHP Function Call Placement

后端 未结 5 610
孤独总比滥情好
孤独总比滥情好 2020-12-17 21:08

Consider this snippet:

function f() {
    return \'hi\';
}

echo f();

Vs this snippet:

echo f();

function f() {
    return         


        
5条回答
  •  盖世英雄少女心
    2020-12-17 21:27

    I find it a good practice to first define my functions and later call them, but it doesn't matters where do you put them as long they're there ;)

    Also, i like to have my functions separated in different php files, depending on the use, just to be organized :)

提交回复
热议问题