Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 29-06-2009
Aston5
 
Posts: n/a
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....!
Reply With Quote
  #2  
Old 29-06-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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";
?>
Reply With Quote
  #3  
Old 29-06-2009
Member
 
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'.
?>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "php return multiple values"
Thread Thread Starter Forum Replies Last Post
Excel 2010: Can VLOOKUP return multiple non-empty values from a table? marathon MS Office Support 3 21-01-2012 01:43 AM
Is it possible for a function to return two values? hounds Software Development 5 13-03-2010 07:51 PM
PHP method to import multiple values joal123 Software Development 4 28-01-2010 10:43 PM
Excel Look up one value and return multiple corresponding values mellisahi Windows Software 5 27-10-2009 12:40 AM
Excel : vlookup multiple values Laler Windows Software 3 25-06-2009 10:27 AM


All times are GMT +5.5. The time now is 03:22 PM.