dae3 wrote:
Jerry Stuckle <js*******@attglobal.netwrote:
>Not a big deal because you really shouldn't be doing it. It's a poor
programming practice which makes code very hard to debug later.
That really isn't the case, Jerry.
I'm doing this to define stripos() IF my program is running on PHP < 5.
This enables it to run on both PHP4 and PHP5 with absolutely no changes.
If you still think this is a poor programming practice or that it makes
the program hard to debug, well... I guess we'll have to disagree on
what "good programming" means.
If you want to determine if a function exists, you should be using
function_exists().
And you can use it to define something like stripos(). But the problem
you can run into is if you have stripos() defined like this in different
different locations - and now someone changes ONE of those functions?
Better would be to conditionally include a file which defines the
function, i.e.
if (!function_exists('stripos'))
include 'stripos.php';
That way you are sure to have only one definition of the function. You
could put the test itself in stripos.php, but that means you're going to
include the file all of the time.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================