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, 5013👍, 0💬
Popular Posts:
How To Export Data to a CSV File? - Oracle DBA FAQ - Introduction to Oracle SQL Developer If you wan...
How do you override a defined macro? You can use the #undef preprocessor directive to undefine (over...
What print out will the folloging code produce? main() { char *p1=“name”; char *p2; p2=(char*)malloc...
How did you implement UML in your project ? PART II Implementation phase / Coding phase (Class diagr...
How does multi-threading take place on a computer with a single CPU? The operating system's task sch...