Is this good approach to use debug functions for implementing features?
Since this is a code review site, let me point out that the following is an abomination:

return (0 == ($v % 2)) ? false: true;


The constants are redundant. Much simpler:

return (0 != ($v % 2));


(The parentheses are also redundant but that’s unrelated.)