Colon¶
Colons are used in a variety of situations:
With named parameters, to separate the name from the value
With labels, for goto
With ternary operator, separated or not from the question mark
In
include_pathandopen_basedir, double-colon is used as a separator
The double colon is a distinct operator.
<?php
goto there;
there:
foo(a: 3); //
$b = $a ? 'a' : 'b';
$c = $c ?: 'a';
?>
Related : Goto, Goto Labels, Ternary Operator, Coalesce Operator, Coalesce Operator, Named Parameters, Scope Resolution Operator ::, Separator, Scope Resolution Operator ::, Semicolon, Static Class