how call function in php

Discussion in 'PHP' started by ayushi infotech, Mar 1, 2011.

  1. #1
    how to call function in php
     
    ayushi infotech, Mar 1, 2011 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    lets say you have these functions :
    
    function sum($a,$b) {
    return $a+$b;
    }
    
    function show($text) {
    echo $text;
    }
    
    PHP:
    You call it like this :
    
    $val = sum(6,5); // val will contain 11
    //or
    echo sum(6,5); // it will print 11
    
    // or the function without a return
    show('here you go');
    
    PHP:
     
    tvoodoo, Mar 1, 2011 IP
  3. happyhosting

    happyhosting Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think OP is looking for something else?
     
    happyhosting, Mar 2, 2011 IP
  4. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well that is how you call a function in php
     
    srisen2, Mar 3, 2011 IP
  5. Mike Griffiths

    Mike Griffiths Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?php

    function_name('argument1', 'argument2');

    ?>
     
    Mike Griffiths, Mar 4, 2011 IP