Fixed php unexpected eof, modified get last order function