On 27 Apr 2006, at 20:51, Saul Rennison wrote:
Anyway, I want to know how to add things to an array. Like this:
$foobar = array()
$foobar['rar']['miaw']
Would that output come out (for the array) as:
array(
'rar' => 'miaw'
)
No, it would create a multi-dimensional array that contains nothing.
You want:
$foobar['rar'] = 'miaw';
Please correct me if wrong. Also I need to ask one more question,
would this
work:
$foobar = array()
function addToArray($int, $value) {
$foobar[$int][$value]
}
And with a function call addToArray(1, "meow") output as the array
looking
like:
array(
'1' => 'meow'
)
No (because of the mistake commented on above). However another issue
at play here is scope. $foobar the array will not be visible to the
function addToArray unless you make it global.
Cheers,
Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php