Minor rewrites to php functions that do not behave as those of us from other languages expect.