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 Define an Array Argument as a Reference Type
Can You Define an Array Argument as a Reference Type? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
You can define an array argument as a reference type in the function definition. This will automatically convert the calling arguments into references. Here is a PHP script on how to define an array argument as a reference type:
<?php
function ref_shrink(&$array) {
array_splice($array,1);
}
$numbers = array(5, 7, 6, 2, 1, 3, 4, 2);
print("Before shrinking: ".join(",",$numbers)."\n");
ref_shrink($numbers);
print("After shrinking: ".join(",",$numbers)."\n");
?>
This script will print:
BBefore shrinking: 5,7,6,2,1,3,4,2 After shrinking: 5
2007-04-24, 5213👍, 0💬
Popular Posts:
How To Concatenate Two Character Strings? - MySQL FAQs - Introduction to SQL Basics If you want conc...
How to create arrays in JavaScript? We can declare an array like this var scripts = new Array(); We ...
Is Session_End event supported in all session modes ? Session_End event occurs only in “Inproc mode”...
How Many Types of Tables Supported by Oracle? - Oracle DBA FAQ - Managing Oracle Database Tables Ora...
How To Create an Add-to-NewsGator Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News...