That's a feature of
zsh inherited from
$path array variable is tied to the
$PATH scalar (string) variable. Any modification on one is reflected in the other.
zsh (contrary to
(t)csh), you can tie other variables beside
typeset -T. It's conventional, but not mandatory, to use an uppercase name for the colon-separated scalar and the same name in lowercase for the array. While colon is the default separator, other separators can be used (for instance newline to tie a multi-line string to an array, or comma to tie a csv row to an array)
In recent versions of
typeset -p PATH or
typeset -p path shows the link between the two variables:
% typeset -p path
typeset -aT PATH path=( /home/chazelas/bin /usr/local/bin /usr/bin /bin )
That's useful in that it makes it easier to add remove components or loop over them.
typeset -U path to make the elements unique also helps keeping the
$PATH variable clean (something similar can be achieved in