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....!
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....!
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"; ?>
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'. ?>
Bookmarks