Update test2.php

Committed the modified code and simplified the code.