Which is the last version which works with php 5.6?
PHP 5.6. has been declared “end of life” and there is absolutely no requirement to run an unsupported and insecure software version anymore (including Nextcloud):
you may write a small script to fetch the following page iterating $nc-version from 17 down to 9 and and grep for php5.6.
as j-ed mentioned: you will be doomed using php 56. the gates of hell will open and your cpu will melt down. you have been warned.
It is NC 13.
There is one reason, if you have an old setup which supports just php 5.6, you might want to upgrade it until the last version with php 5.6, before switching to a different php version.
But you should upgrade to NC16 soon (the oldest still supported version).