开发者

http://www.php.net/manual/en/class.mysqli-stmt.php What does void mean?

开发者 https://www.devze.com 2023-02-25 06:16 出处:网络
You will notice that for prepared statements, the php.net list of functions is available at http://www.php.net/manual/en/class.mysqli-stmt.php even functio开发者_StackOverflowns such as -> execute();

You will notice that for prepared statements, the php.net list of functions is available at http://www.php.net/manual/en/class.mysqli-stmt.php even functio开发者_StackOverflowns such as -> execute(); have the word void next to them what does this mean?

As I use many of these in my scripts, is it safe to do so?


Void just means nothing is returned when the method has finished executing.


void means "nothing" (in the meaning of the word). In PHP its equivalent to null. Usually you describe a return value with void, if the return expression in the method is completely omitted, whereas null as return value usually means

return null;

Note, that void is a pseudo-type in PHP. It doesnt exists in PHP and its only used in documetation to tell you, that there is really nothing (useful) returned.


From the PHP Manual on Pseudo-Types and Variables:

void as a return type means that the return value is useless. void in a parameter list means that the function doesn't accept any parameters.


Just like bool and int, void is a type. Placed beside a function declaration's name, it signifies that the function does not return anything. However, that does not mean the function does not perform any operations; it may have side effects, or it may execute other commands without passing anything back to the receiver.

0

精彩评论

暂无评论...
验证码 换一张
取 消