Jump to content
xisto Community
Sign in to follow this  
ginginca

Really Quick Question (i Hope)

Recommended Posts

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 by ginginca (see edit history)

Share this post


Link to post
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.