void and null function 'returns' in PHP · 22 September 2009, 16:53
<?php
function hasNoReturnValue() {
//return null;
}
function hasNoReturnValueButReturns() {
return /*null*/;
}
*function* returnsNull() {
return null;
}
var_dump(hasNoReturnValue());
var_dump(hasNoReturnValueButReturns());
var_dump(returnsNull());
?>
results in
NULL NULL NULL
In case you were wondering. E_ALL reports nothing out of the ordinary, either. It’s all very well-behaved and straight-forward. Glee.
— Neike Taika-Tessaro
Comment
| Categories: | php |
|---|---|
| Related: | Extending phpDocumentor with custom tags · 23 October 2009, 19:36PHP loose type comparison: Arrays · 18 September 2009, 13:30Quick PHP block comment toggle · 18 September 2009, 11:58Global variables in PHP · 17 October 2007, 17:35Filter-explode · 15 October 2007, 12:43 |