there can only have one version running at your environment at a time but you can have multiple version sit in your system and use it, by executing php with specifying the actual full path of the php
for example, my system running php 7.4, whenever i want to have php 5.6 i will just run c:\php\php56\php instead of just php... I'm using Windows but i believe it work the same way in other platform as well...
you also can setup multiple virtual hosts in your apache or web server with different php version...