Php Logical Interview Question