variable dynamique en php

make variable:
$var = 'myvalue';

update variable:
$var = 'new value';

dynamically updating a variable on the frontend cannot be done in php onlywithout a full call to the backend and refresh of the page.
use javascript if that is what you need
Literate Lentil