https://lavrynenko.com/uroki-php-peredacha-peremennyx-v-function/
Уроки PHP - передача переменных в function