Php function argument error suppression, empty() isset() emulation

后端 未结 14 558
执笔经年
执笔经年 2021-01-11 17:32

I\'m pretty sure the answer to this question is no, but in case there\'s some PHP guru

is it possible to write a function in a way where invalid arguments or non exi

14条回答
  •  伪装坚强ぢ
    2021-01-11 18:14

    is it possible to write a function in a way where invalid arguments or non existent variables can be passed in and php will not error without the use of '@'

    Yes you can!

    porneL is correct [edit:I don't have enough points to link to his answer or vote it up, but it's on this page]

    He is also correct when he cautions "But I recommend against abusing this for hiding programming errors." however error suppression via the Error Control Operator (@) should also be avoided for this same reason.

    I'm new to Stack Overflow, but I hope it's not common for an incorrect answer to be ranked the highest on a page while the correct answer receives no votes. :(

提交回复
热议问题