Need PHP help - Conditional functions

Discussion in 'PHP' started by OWL_on_NG, Jan 9, 2007.

  1. #1
    Could someone please explain this to me? I have read about it but still do not understand it.
     
    OWL_on_NG, Jan 9, 2007 IP
  2. ConnorWilson

    ConnorWilson Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you mean things like if, else, etc... Then a quick Google search will provide you with a ton of basic tutorials. The syntax is quite easy to follow. Same solution if you're talking about conditional loops.
     
    ConnorWilson, Jan 9, 2007 IP
  3. smallbuzz

    smallbuzz Peon

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    what's a conditional function?
     
    smallbuzz, Jan 9, 2007 IP
  4. OWL_on_NG

    OWL_on_NG Active Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #4
    That's sort of what I'm asking.
     
    OWL_on_NG, Jan 9, 2007 IP
  5. klown

    klown Peon

    Messages:
    2,093
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #5
    klown, Jan 9, 2007 IP
  6. OWL_on_NG

    OWL_on_NG Active Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #6
    Link didn't work.
     
    OWL_on_NG, Jan 9, 2007 IP
  7. klown

    klown Peon

    Messages:
    2,093
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #7
    try again.. works fine
     
    klown, Jan 9, 2007 IP
  8. OWL_on_NG

    OWL_on_NG Active Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #8
    I tried again, I restarted and tried again, for some reason my browser is not showing your site, though it loaded, and I can see the source code.
     
    OWL_on_NG, Jan 9, 2007 IP
  9. klown

    klown Peon

    Messages:
    2,093
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #9
    OMG its not working in IE.. luckily other pages are.. still its not good..

    I guess try using FF..
     
    klown, Jan 9, 2007 IP
  10. Chemo

    Chemo Peon

    Messages:
    146
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #10
    
    if ( !function_exists('functionName')){
      function functionName(){}
    }
    
    PHP:
     
    Chemo, Jan 9, 2007 IP
  11. OWL_on_NG

    OWL_on_NG Active Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #11
    Oh, ok that makes sense now, thanks.
     
    OWL_on_NG, Jan 9, 2007 IP
  12. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Chemo is on the right track, I think. I looked at this thread a while ago and didn't know what 'conditional functions' were, so I steered clear :)

    But yeah, Chemo makes a good point and he jolted my memory: it may also be in reference to using call_user_func ( http://ca3.php.net/manual/en/function.call-user-func.php ) whereby you can use a variable to define the name of the function to call.
     
    TwistMyArm, Jan 10, 2007 IP
  13. Northie

    Northie Peon

    Messages:
    80
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #13
    There's always the php website, www*php.net

    if(statement) {
    $result = Function_A();
    } else {
    $result = Function_A();
    }

    or

    function testFunction($var) {
    if($var==statement) {
    //do somthing
    //return something
    } else {
    //do somthing else
    //return something else
    }
    //or return something here
    }
     
    Northie, Jan 10, 2007 IP
  14. kohashi

    kohashi Well-Known Member

    Messages:
    1,198
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    140
    #14
    en.wikipedia.org/wiki/Conditional_statement

     
    kohashi, Jan 10, 2007 IP