scottybwoy Posted February 21, 2007 Share Posted February 21, 2007 I use global quite a bit and thought I understood it. However When I call it in a function it seems to delete the contents let me show you how I'm utilising it: <?php function salesPrep($data_array) { global $data_array; echo '<u><b>$data_array</b></u><br>'; print_r($data_array); ?> I thought that would make it available to the code it returns too however it completely wipes the array. If I remove it, it works fine, but is not accessible to the rest of my code which I want, any pointers? Thanks. Link to comment https://forums.phpfreaks.com/topic/39510-solved-global-confusion/ Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 If you're passing $data_array, you don't also use global $data_array. Pick one or the other... Link to comment https://forums.phpfreaks.com/topic/39510-solved-global-confusion/#findComment-190620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.