ginginca 0 Report post Posted November 19, 2006 (edited) I'm writing some error checking code and my PHP editor colors the script ... and am running into a (dumb) question.(Sorry - I'm learning).I have typed the following: if (!is_integer($item_1_qty)) { //qty is not a number $redirect_to = 'order_form.php?error=1'; header("Location: $redirect_to"); exit(); } I don't understand why my is_integer is black when I am expecting it to be blue. When you do if (empty$ etc ... empty is blue. I'm a bit confused about that.Gin Edited November 19, 2006 by ginginca (see edit history) Share this post Link to post Share on other sites
vujsa 0 Report post Posted November 20, 2006 I guess that this could just be you editor acting up. I'm not sure what your editor is set up to do with the various elements in your script. Here is what PHP Designer 2005 does with the code. if (!is_integer($item_1_qty)) ???? ???? { ???? ???? //qty is not a number ???? ???? $redirect_to = 'order_form.php?error=1'; ???? ???? header("Location: $redirect_to"); ???? ???? exit(); ???? } But here is what I get for empty: if (!empty($item_1_qty)) ???? ???? { ???? ???? //qty is not a number ???? ???? $redirect_to = 'order_form.php?error=1'; ???? ???? header("Location: $redirect_to"); ???? ???? exit(); ???? } Perhapes different types of functions are highlighted differently or maybe the editor doesn't know newer function or can't properly determine what a function looks like. header() is a function but is blue in both examples but exit() is green in both. They are both common functions so why is one green and the other blue? I suppose that there could be PHP version considerations taken into account and green is always compatable but you ned to check the PHP version for the blue. Personally, I have PHP Designer 2005 but I never use it. I still use an old version of CuteHTML which tries to highlight all my code like it was HTML. As a result, I never even notice the color of the text anymore. Old dog new tricks etc... I guess that my point is that while these syntax highlighters are helpful at times, they shouldn't be relied upon for critical applications. So the answer to your "dumb question" is that I really don't know so that makes us both "dumb" I guess! vujsa Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 20, 2006 is_integer() is an alias for is_int(). Maybe try is_int() or is_numeric after casting the variable as an integer in the comparison? Share this post Link to post Share on other sites