Really Quick Question (i Hope)

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Really Quick Question (i Hope)

ginginca
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:

CODE
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

Reply

vujsa
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.

QUOTE

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:
QUOTE

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. tongue.gif 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

 

 

 


Reply

jlhaslip
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?

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : quick, question, hope

  1. Ask An Open Question 404 (and A Confused Noob)
    (3)
  2. Question Related To Website
    need Web page solution (5)
    I have some question in mind that need solution so please 1) What is benefit of using header and
    footer tag in our web page ? 2) How we can registered our website on any search engine? 3) Did I use
    animated image without flash in website.? 4) What is the correct way to display web page on center
    in any browser.? if we use css style ? I have little idea off all question answer but i need
    specific help so welcome. Thanks....
  3. Pointers
    Pointer Question (0)
    Are pointers optional because I don't understand them clearly. The tutorials are too not
    noob-friendly... So: Are pointers optional in mosty programs? Do YOU know any noob-friendly
    tutorials on pointers? Thanks in advance for taking your time and answering this~!....
  4. Question: Ssh Tunneling
    (1)
    I'm not sure if this is the correct place to pose this question or not, but it seemed close. If
    I was wrong, I apologize in advance. Essentially, I am looking to do ssh port forwarding
    (tunneling) to access a database via localhost. I know how to do this on a unix box, but am new to
    doing it on windows. Any help would be appreciated.....
  5. Basic Html Tutorial
    Made it myself, hope you like it. (1)
    HTML stands for hyper text markup language. It is a basic coding language used on almost every
    website. There are some tags in HTML which must be used, whilst others are enhancing, but not
    essential. Below I shall list the essential tags and there uses: This tells the browser that
    the language between the tags is going to be HTML so it knows how to read it. Inbetween those tags
    come These tags tell the browser that all the content that you wish to be displayed is in there.
    They are the only essential tags for HTML! The list is short but if you only use them your ....
  6. Slipknot - All Hope Is Gone
    New slipknot album (0)
    I just got the tracks and watched the video (posted below). Very cool / interesting if you're a
    fan. They have a slightly different sound in this track. They have a guitar solo and a different
    rhythm as well. Over the years I've certainly felt like they've matured and improved since
    they started. I've recently been listening to Stone Sour (and have become quite fond of them).
    I'm really enjoying the album! http://www.youtube.com/watch?v=1i_72iKvbtI Anyone else here a
    fan? Have an opinion on their stuff?....
  7. Css Minus The <p>
    A very newbie CSS question (9)
    Most beginner pages on CSS give introductory examples of how to change font style for a page, by
    doctoring up the tag, CODE blah blah blah blah blah I'm finding that this is
    pretty annoying to use. It doesn't always work and it adds blank lines (being the tag
    because that's what does) around things when I want those lines to be close together. In
    Tables, it's really annoying to have ... inside every ..... just because I want to
    return to my standardised "somestyle" font settings. /dry.gif" style="vertical-align:middle" emo....
  8. Question About Opengl Codes.
    (0)
    Hey! I've started to learn windows API programming. And I've been using OpenGL. I am
    following a tutorial, But I didn't understand every comment. So I rewrote the code some times to
    learn it, and made my own comments. Some of the rows have the comment "What do this row do??". I
    would be happy, if you could explain those rows to me =), please. And BTW: I am only on the first
    tutorial. When I start with the others, I am sure I will have more questions. And if someone else
    have a questions about OpenGl, feel free to ask them here, instead of starting a new t....
  9. Php Question, Help Please
    (5)
    Im testing to make a site, i made a bit of the code and using Feelay's login system, but can
    this code make safer and better? CODE session_start(); ?> $skin = $_GET ;
    if($skin=='1'){ $_SESSION =''; }elseif($skin=='2'){ $_SESSION
    ='1'; }elseif($skin=='3'){ $_SESSION ='2';; }elseif($skin=='4'){
    $_SESSION ='3'; } ?> "http://www.w3.org/TR/html4/loose.dtd"> $id = $_GET ;
    if($id=='1'){     echo ' 1 '; }elseif($id=='2'){     echo ' 2
    '; }elseif($id=='3....
  10. Simple Java Question
    One Variable; Multiple Classes (3)
    I’m probably the only person that is able to do so much with Java3D and yet still can't
    even get some of the Java basics down. Anyway is it (and if so how is it) possible to make a
    variable editable and readable in multiple class files? It seems like this should be an easy
    question to answer, but here is a little code to help you understand what I am talking about. CODE
    public class test extends Applet{  public int Col = 0;      if(Col==1){     } } class
    TestB extends Behavior {    if(collision == true){   Col = 0;  }else{   Col = 1;  } } Tha....
  11. Joomla License Question
    (1)
    I have a small question of the joomla license. I know Joomla is release under the GNU/GPL license
    and that it means I can freely use, copy and alter the source code as long as the license
    information is retained. I know that this is possible for non-commercial use, but what about
    commercial use ? The reason why I ask this is because I've been asked to create a website for a
    store (a bio-store to be exactly) where the owners can place announcements from time to time. Can I
    do this with joomla ? (btw. they have no intentions for having an online shop, just some announ....
  12. Dynamic Php Image And Better Php Code Question
    (10)
    Im working on a dynamic image, can i put 2 images in same dynamic image, and can i make this code
    shorter? if ( $goal == 31 ) { $xp2 = ('14833'); } elseif ( $goal == 32 ) { $xp2 =
    ('16456'); } elseif ( $goal == 33 ) { $xp2 = ('18247'); } elseif ( $goal == 34 ) {
    $xp2 = ('20224'); } elseif ( $goal == 35 ) { $xp2 = ('22406'); } elseif ( $goal ==
    36 ) { $xp2 = ('24815'); } elseif ( $goal == 37 ) { $xp2 = ('27473'); } elseif (
    $goal == 38 ) { $xp2 = ('30408'); } elseif ( $goal == 39 ) { $xp2 = ('33648')....
  13. Private Servers Question
    (13)
    Is a private server illegal or its legal? I saw many servers when i search at google, Runescape,
    WoW, Ragnarok and some more... If its illegal, is it illegal when playing or hosting, or both?
    /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" />....
  14. 4 Ram Slots Question
    (6)
    Alright, here's a great question for the Astahost community and I hope you guys can answer this.
    My motherboard has 4 RAM slots, on the motherboard markings, RAM0 and RAM1 are grouped as DIMM1;
    while RAM2 and RAM3 are grouped as DIMM2. Does this mean that DIMM1 is its own independent speed
    bank with its own path to the processor and DIMM2 has its own path as well? I ask this because I
    bought DDR2-667 instead of DDR2-800 because 667s were cheaper than 800s last month, now they are
    almost the same price. I'm planning to buy 2 1GB DDR2-800s to make my system have ....
  15. Concept Of Hijaab In Islaam
    different question regrding women in Islam and their answerzzzzz (2)
    Why shud a Muslim woman be subjugated to da compulsion of a dresscode? Isn’t this restraining her
    human rights and her freedom of choice? Does da rule of ‘Hijab’ (a scarf coveringda head) suppress
    or liberate women’s individuality? Can a Muslim lady observing ‘Perdah’ be a women’s rights
    activist? Wat does feminizm hav to do with a tyrannical, patriarchal religion like Islam? dis effort
    is to answer these and many similar questionz -- to enlightenn and to strip awayyy the veil of
    ignorance, prejudice and baseless suppositionz dat non-Muslimz around da globe hav against I....
  16. Do Google Search Better Than Yahoo?
    This is a question for you all google users!! (15)
    Do you think google search is better than yahoo?? Are they have similar search?? Well for me google
    search is more effective than yahoo search engine.....
  17. Gaia Online Question
    Gaia online question cheat (6)
    Hiya! I play Gaia online and I've been wondering if its possible to log onto more then one
    account at a time on one computer. If anyone knows how do this on Mozilla firefox, it would be
    greatly appreciated.....
  18. How To Get Quick And Easy Levels In Runescape
    on runescape the massive multiplayer online role playing game! (12)
    Thieving, the hated skill that is incredibly slow and boring to train at lower levels. Pyramid
    Plunder is the way to get high thieving, and is pretty simple to do once you get the hang of it.
    Where is it? Pyramid Plunder is located in Sophanem. To get there from Shantay, head into the
    desert and travel on the magic carpet to Pollnivneach, once there, run south until you find the next
    magic carpet ride, ride that to Sophanem. When you arrive, enter the gates, and the Pyramid Plunder
    mini-game is in the first Pyramid you see. Or, alternatively, you can use a Pharoah&....
  19. Ipod Hardware And Software Question
    (9)
    I had a problem with my 40GB 4th Generation iPod. It was giving me the sad iPod icon. I tried
    restoring it to factory default but it wasn't even detected. So I opened up the iPod and tried
    reseating all the cables. I wasn't paying attention and forced the hard drive cable in (I know,
    stupid thing to do especially for me). I'm usually more careful, but now the extra "pin" (maybe
    a ground) at the end is broken and stuck into the wrong side of the hard drive. I put it in the
    correct way now minus that "ground" pin at the end (which is still stuck on the other si....
  20. What's The Best CMS
    CMS or not CMS?, that is the question (38)
    read many artical and try many CMS, but still haven't find a best CMS, have you find it?
    phpWebSite Tiki XOOPS TYPO3 FreeWPS XDBCMS Nucleus CMS Mambo....
  21. VB.NET / MS Access Question
    (6)
    Jeez .. i can see people already starting to take up sticks and stones to beat me up .. well .. i
    know m annoying .. and this always happens when my questions are related to programming
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Newayz ..
    to the point .. I have an MS Access DB .. I need a VB Code to retrieve the value from a field in
    the table. Let me just put it in a better way. I have a table that has a column: Sno. .. under
    sno. i have numbers like 1,2,3,4,5,6,7,8 .... now i created a form where i could view the rec....
  22. Web Browser And Taskbar Problems (web Browser Disappears)
    Question about web browsers and taskbar (7)
    First off, I would like to say thanks for taking the time to read my thread... Er then I won't
    have a second or any others, I will just get to my questions. Okay, so I recently noticed that my
    web browser windows when I minimized them to the task bar just disappeared. They seemingly minimzed
    to a spot that I couldn't see to the down and right of the start button. I know how to get
    around this in a couple of ways if I have to... But I was just curious to see if anyone knew how to
    fix it a better way? My "solutions" to fix it are: 1) If I hit ALT+TAB at the s....
  23. MySQL Output Database Question
    (18)
    I am new to MySql and have just created a database after using a script. My problem is not the
    script, but what it says about putting it into the output file. I cant figure out the right terms
    to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
    'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
    please help me out?....
  24. How To Install Applications In Fedora
    noob question (12)
    I'm a linux user since a few days, i've decided to change to linux coz i'm not very
    pleased with Windows versions . So i wonder how do i install aplications like Files Sharing and mp3
    ?....
  25. Switch Network Settings With Batch Files
    A quick way to change IP, Gateway, DNS (18)
    Let's suppose you are using two network settings with your laptop frequently. Wether it's a
    wireless or wired network, all the same: Every time you want to change the IP, subnet mask, default
    gateway and DNS Server(s) of your network connection in any flavour of Windows, you have to click
    through menus, submenus, and from that you go to yet another submenu... you have been there,
    it's awful. /mad.gif' border='0' style='vertical-align:middle' alt='mad.gif' /> There is a
    better way: the command "netsh" on your command prompt can change all the aforementio....
  26. Question About Asp Now() Function
    How to display 24 hour time format (6)
    I am learning asp currently. The learning environment is windows 2003 plus the builtin IIS. Time
    format in this machine is set to 24 hours format (hh:mm:ss). However, when i call the Now()
    function in a ASP script, the time it caught and displayed as "2005-7-29 7:32:40pm". Is there
    anyway to make it displayed in 24 hours format.?? Just like this "2005-7-29 19:32:40" ....
  27. Mp3 Questions
    a question for a mp3 beginner like me (14)
    Hello... You all like to download MP3 's online right? Well, hmmm... i love to download them
    and burn them in a cd but there's some unanswered questions roaving in my mind. Example, I
    have many duplicates of one song with different file names, well, I want to remove those duplicate
    ones ... how? And MP3 is compressed right? Is there a way to uncompress those compressed
    sound so that I will really do unlock the wonderful sound of the audio?....
  28. Question: Vector Based Animation?
    Free flash like programs... (4)
    Hello there! I have experience in flash through art classes in school, and Being a 16 year old on a
    low budget, I was curious if there were any flash like programs out there for free? I know free is
    pushing it lol... but Im desperate and my creative imagination needs to be released. I'm just
    looking for something that has the basic feel and capabilities of flash. Im looking for something
    that will be vector based, will animate, and will allow sounds to be added into the background! Any
    information would be awesomely appreciated! Thanks much!....
  29. Question About Professional 3d Animating
    I.E. Pixar (21)
    Does anyone know what kind of animating programs comapanies like pixar or dreamworks use? I'm
    wondering, because I'm kinda looking into professional animations, and need some advice on what
    program to use... flash works for 2d, but i dont think i can do 3d very well in in. Thanks Peace
    aaron....
  30. Hotkeys / Keyboard Quick Launch Keys In Linux
    (5)
    I first submitted this tutorial a couple of months ago over at http://linuxiso.org/forums as user
    adpsimpson. Having spent ages wishing the hotkeys on my laptop would work, I spent most of an
    afternoon looking into it. Since no site I found explained it satisfactorily, here's my
    method... The first step is to find out which of the keys are registered by the kernel, and what
    their keycodes are (the unique event number that they cause). To do this you need a program called
    xev, (in Mandrake this is part of X11R6-contrib, is installed by default in Slack, and should....

    1. Looking for quick, question, hope






*SIMILAR VIDEOS*
Searching Video's for quick, question, hope
Similar
Ask An Open Question 404 (and A Confused Noob)
Question Related To Website - need Web page solution
Pointers - Pointer Question
Question: Ssh Tunneling
Basic Html Tutorial - Made it myself, hope you like it.
Slipknot - All Hope Is Gone - New slipknot album
Css Minus The <p> - A very newbie CSS question
Question About Opengl Codes.
Php Question, Help Please
Simple Java Question - One Variable; Multiple Classes
Joomla License Question
Dynamic Php Image And Better Php Code Question
Private Servers Question
4 Ram Slots Question
Concept Of Hijaab In Islaam - different question regrding women in Islam and their answerzzzzz
Do Google Search Better Than Yahoo? - This is a question for you all google users!!
Gaia Online Question - Gaia online question cheat
How To Get Quick And Easy Levels In Runescape - on runescape the massive multiplayer online role playing game!
Ipod Hardware And Software Question
What's The Best CMS - CMS or not CMS?, that is the question
VB.NET / MS Access Question
Web Browser And Taskbar Problems (web Browser Disappears) - Question about web browsers and taskbar
MySQL Output Database Question
How To Install Applications In Fedora - noob question
Switch Network Settings With Batch Files - A quick way to change IP, Gateway, DNS
Question About Asp Now() Function - How to display 24 hour time format
Mp3 Questions - a question for a mp3 beginner like me
Question: Vector Based Animation? - Free flash like programs...
Question About Professional 3d Animating - I.E. Pixar
Hotkeys / Keyboard Quick Launch Keys In Linux
advertisement




Really Quick Question (i Hope)



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE