Results 1 to 4 of 4

Thread: Noob QUESTION HERE...

  1. #1

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Noob QUESTION HERE...

    okay...Ive used this effectively once before.... but i havent used it in a while and cant remember where in the book i saw it... and where in php.net i seen an example used with it...

    i feel kinda silly... but im here... asking away anyways...lol...


    the thing im looking for is...sumtin like
    PHP Code:
    ($row['blah']==""?"0":$row['blah']) 
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  2. #2
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: Noob QUESTION HERE...

    That's an if statement that uses the ternary operator:
    PHP Code:
    // one liner
    $foobar = ($row['blah']== "") ? "0" $row['blah'];



    // would look like this written out
    if($row['blah'] == "")
    {
       
    $foobar "0";
    }
    else
    {
       
    $foobar $row['blah'];

    {yak}

  3. #3

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Noob QUESTION HERE...

    hmm... okay.... thanks... lol... that helped.

    It seems bery useful.Confusing... but useful nontheless.

    Hmm... What would i look for on PHP.NET for more examples of this...?

    i tried ternary , ternary operations, ternary operator, ternary operators
    Last edited by PlaGuE; Oct 8th, 2005 at 06:17 PM.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  4. #4
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: Noob QUESTION HERE...

    {yak}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width