Hi everybody,
I know I'm still a noob with php, but I feel so sad I couldn't manage such a simple (at least apparently) issue.
Here's what I want to achieve, in general:
- I'm reading XML files via simple_xml
- while reading I would populate an array with some strings from the XMLs, if some specific conditions are satisfied
- as I need to read several XML files, I must populate the array from within a function
Easy, isn't it? Unfortunately, not for me...
When I try to pass an array to the function, the array is not recognized.
here's a sample:
$array = array();
$array[0] = "ciccio";
$array[1] = "coccio";
$array[2] = "pasticcio";
$array[3] = "astuccio";
$n = 5;
function push_array($a,$in){
array_push($a,$in);
}
for(i=0; i<$n; i++){
push_array($array,$i);
print_r($array);
echo "<br/>";
}
and here it is the result:
Array ( [0] => ciccio [1] => coccio [2] => pasticcio [3] => astuccio )
Array ( [0] => ciccio [1] => coccio [2] => pasticcio [3] => astuccio )
Array ( [0] => ciccio [1] => coccio [2] => pasticcio [3] => astuccio )
Array ( [0] => ciccio [1] => coccio [2] => pasticcio [3] => astuccio )
Array ( [0] => ciccio [1] => coccio [2] => pasticcio [3] => astuccio )
:(
Where am I wrong?
Thanx evrybody,
S