lilman Posted November 16, 2006 Share Posted November 16, 2006 I have an array, let's say $array[1]=value, $array[2]=value, $array[3]=value. I want to pass it through a function, let's say function test(), now instead of having to do it this way: test($array[1], $array[2], $array[3]), is there an easier way to do this? Link to comment https://forums.phpfreaks.com/topic/27524-passing-an-array-through-a-function/ Share on other sites More sharing options...
roopurt18 Posted November 16, 2006 Share Posted November 16, 2006 [code]<?php$arr = array( 1, 2, 3);test($arr);function test($an_array){ print_r($an_array);}?>[/code] Link to comment https://forums.phpfreaks.com/topic/27524-passing-an-array-through-a-function/#findComment-125850 Share on other sites More sharing options...
Branden Wagner Posted November 16, 2006 Share Posted November 16, 2006 you can pass an array just like you woulda variable. Link to comment https://forums.phpfreaks.com/topic/27524-passing-an-array-through-a-function/#findComment-125857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.