Reply to Passing array by reference.

Your name:

Reply:


Posted by David Smithz on 01/15/07 01:07

Is it possible to pass arrays by reference?

Already have a work around for the below by using a foreach instead, but I
am still interested to know why the below did not work as the final array
was always blank despite my debugging output suggesting everything works
inside the function.

The code below uses the array walk function:



function check_if_FV_TES ($value, $key, &$ary_of_FVs) {
echo "<BR>Here we are: $key $value," . substr($key, 0, 6);

if (substr($key, 0, 6)=="FV_TES") {
echo "<BR>We got a match:". substr($key,11);
#Place this key and string into another variable (note we get the part
after 9 characters as the first 9 identify fiel type, actual name starts
then
$ary_of_FVs[substr($key,11)] = $value;
echo "<BR>:here is the array so far:";
print_r($ary_of_FVs);
};
}

#Create a blank array to stor the form variables
$ary_Fulllist_of_FVs = array();

#Call the array walk
array_walk($_REQUEST, 'check_if_FV_INP', $ary_Fulllist_of_FVs );


$ary_Fulllist_of_FVs - always had a blank array at the end.

Any ideas?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация