Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Return an Array from a Function
How To Return an Array from a Function? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
You can return an array variable like a normal variable using the return statement. No special syntax needed. Here is a PHP script on how to return an array from a function:
<?php
function powerBall() {
$array = array(rand(1,55), rand(1,55), rand(1,55),
rand(1,55), rand(1,55), rand(1,42));
return $array;
}
$numbers = powerBall();
print("Lucky numbers: ".join(",",$numbers)."\n");
?>
This script will print:
Lucky numbers: 35,24,15,7,26,15
If you like those nummers, take them to buy a PowerBall ticket.
2007-04-24, 5078👍, 0💬
Popular Posts:
Can Two Forms Be Nested? - XHTML 1.0 Tutorials - Understanding Forms and Input Fields Can two forms ...
How To Get the Minimum or Maximum Value of an Array? - PHP Script Tips - PHP Built-in Functions for ...
What will happen in these three cases? if (a=0) { //somecode } if (a==0) { //do something } if (a===...
How To Create an Add-to-Bloglines Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News...
How To Use an Array as a Queue? - PHP Script Tips - PHP Built-in Functions for Arrays A queue is a s...