Results 1 to 3 of 3

Thread: php return multiple values

  1. #1
    Aston5 Guest

    php return multiple values

    I am using PHP & wanted to to build a fuction which will return multiple value. I was getting confused so i have posted it here. Can someone solve my problem???? Please Help....!

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: php return multiple values

    PHP Example returning multiple value

    Code:
    <?php
    function maykit() {
      $rv = array("8","10");
      array_push($rv,"Tech");
      return $rv;
      }
    list($fno,$sno,$name) = maykit();
    print "We have $fno and $sno for $name\n";
    ?>

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: php return multiple values

    The values are returned using the optional return statement. You can return any type, including objects and commands. This makes the function stops execution and immediately return control to the line which was called. See return() for more information.

    Code:
    Example #1 Use of return()
    <?php
    function square($num)
    {
       return $num * $num;
    }
    echo square(4);  // outputs '16'.
    ?>

Similar Threads

  1. Replies: 3
    Last Post: 21-01-2012, 01:43 AM
  2. Is it possible for a function to return two values?
    By hounds in forum Software Development
    Replies: 5
    Last Post: 13-03-2010, 07:51 PM
  3. PHP method to import multiple values
    By joal123 in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 10:43 PM
  4. Replies: 5
    Last Post: 27-10-2009, 12:40 AM
  5. Excel : vlookup multiple values
    By Laler in forum Windows Software
    Replies: 3
    Last Post: 25-06-2009, 10:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,873,654.03529 seconds with 17 queries