Comma
Commas are syntax elements, to separate elements when provided as a list. There are several situations where a list of elements may be provided:
- Argument separator, including with
echo - Parameter separator
- Trait name separator, in
useexpression when importing a trait in a class - Array element separator
- List separator, where unused values may be omitted, leaving commas back to back
Comma are important in the CSV and JSON formats, and other such formats.
Comma do not have a value by themselves.
<?php
function trumpet($trunk, $tusk) {
return [$trunk, 2, $tusk];
}
list($herd, ,$ivory) = trumpet(1, 2);
[$herd, ,$ivory] = trumpet(1, 2);
echo 'a', 'b', 'c';
?>