For example, I have a list like this in php: <?php $GLOBAL->getTopbar(); $GLOBAL->getBottombar(); $GLOBAL->getMonkeybar(); $GLOBAL->getBigbar(); ?> PHP: Which each thing calls a class to get parts of my website layout. But to make it more organized I want to have it like something like this: <?php $array = array($GLOBAL->getTopbar(), $GLOBAL->getBottombar(), $GLOBAL->getMonkeybar(), $GLOBAL->getBigbar()); echo $array; ?> PHP: Something like that, but how would I go about doing that? Well in a more simpler way.
Run a print_r($array) to see what the array contains. You could also do: $array = array( 'topBar'=>$GLOBAL->getTopbar(), 'bottomBar'=>$GLOBAL->getBottombar(), 'monkeyBar'=>$GLOBAL->getMonkeybar(), 'bigBar'=>$GLOBAL->getBigbar()); Access via: $array['topBar']; etc... http://www.php.net/array
First off, I've never had to use $GLOBAL, or global for that matter except within a function where the local scope takes over. Secondly if you're refering to commands like. $Site->FunctionName(); PHP: That's not an array but a class. For example your stuff above. class MyClass { function getTopBar() { ... } function getBotomBar() { ... } } $mySite = new MyClass; $mySite->getTopBar(); PHP: Course I've always used include() to bring in pieces like top, middle, sidebar, etc. If $Global is from a class... why you need to put it's functions into an array, wouldn't that just make the code longer?
Ok jestep, I was off by a little bit and thanks. Also how do I echo or print everything in the array without having: Array (blah) at the bottom of the layout?