Re: Question for PHP Arrays
| From: | Jochem Maas | Date: | Fri, 28 Apr 2006 17:53:21 +0000 |
| Subject: | Re: Question for PHP Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235034@lists.php.net to get a copy of this message | ||
Saul Rennison wrote:
Hi, I'm making a PHP Installer that is customizable by using plugins, I haven't used PHP for a while and which I have forgotten some things about PHP *eek*..$hiddenKnowledge = unforgetPHP();
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' ) 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:I think you have been eating too much Ruby (or something like that) because that function won't return or output anything. you need to always specify a value to return. just out of interest; what is stopping you from cut/pasting those 3-4 lines into a file and running it? (it would take less time than it did for you to write your post and the answer you get back from the php binary/module would have been alot less sarcastic than mine)
array( '1' => 'meow' ) -- Thanks, dphiance (Saul Rennison)