array problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

array problem

Post by itsmani1 »

Code: Select all

 
    $arr[] = array("foo" => "bar", 12 => true);
    
    $arr[] = array("fo" => "ba");
 
this code has following output:

Code: Select all

Array
(
    [0] => Array
        (
            [foo] => bar
            [12] => 1
        )
 
    [1] => Array
        (
            [fo] => ba
        )
 
)
I wanted output like this:

Code: Select all

Array
(
    [0] => Array
        (
            [foo] => bar
            [12] => 1
            [fo] => ba
        )
 
)
acaibdu
Forum Newbie
Posts: 1
Joined: Sat Oct 31, 2009 8:01 am

Re: array problem

Post by acaibdu »

I have the same problem. Thanks for sharing.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: array problem

Post by Mark Baker »

$arr[0] = array("foo" => "bar", 12 => true);
$arr[0] = array("fo" => "ba");
Post Reply