Documenting Parameters¶
<?php
// what does 1 and true mean here?
$keys = array_keys($array, 1, true);
// yes but of course
$keys = array_keys($array, filter_value:1, strict:true);
?>
Sometimes, even a literal value used as parameter is not readable. An easy way to document the literal values is to provide the name of the parameter. Since the parameters need a smart name to be used in the method, using it in the method call provides more context to the parameter.
Another option is to make that literal value a constant, and use that constant to provide a readable name.
See Also¶
PHP Features¶
Last updated: 14 July 2026