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:
Can You Pass an Array into a Function
Can You Pass an Array into a Function? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
You can pass an array into a function in the same as a normal variable. No special syntax needed. Here is a PHP script on how to pass an array to a function:
<?php
function average($array) {
$sum = array_sum($array);
$count = count($array);
return $sum/$count;
}
$numbers = array(5, 7, 6, 2, 1, 3, 4, 2);
print("Average: ".average($numbers)."\n");
?>
This script will print:
Average: 3.75
2007-04-24, 5214👍, 0💬
Popular Posts:
What is the difference between CALL_FORM, NEW_FORM and OPEN_FORM? CALL_FORM: start a new form and pa...
How can you implement MVC pattern in ASP.NET? The main purpose using MVC pattern is to decouple the ...
How Many Tags Are Defined in HTML 4.01? There are 77 tags defined in HTML 4.01: a abbr acronym addre...
How To Insert Multiple Rows with a SELECT Statement? - MySQL FAQs - Managing Tables and Running Quer...
How Can we change priority & what levels of priority are provided by Dot Net? Thread Priority ca...