Jump to content

anyone know how to fix the array_merge problem from PHP 4 to 5


c_shelswell

Recommended Posts

Hi i'm using PHP 4.x on my dev box and i've just uploaded a test page to my server which recently upgraded to php 5.

I'm using array_merge and it works just great on my box but when i stuck it online i get this:
Warning: array_merge_recursive() [function.array-merge-recursive]: Argument #4 is not an array

I've tried array_merge_recursive too but to no effect.

here's my code:

$startDatesArray = array_merge_recursive($m, $c, $r, $gr, $cr);

all the $m, $c etc variables are arrays as well.

bit stuck. Did a bit of googling and found that it's a php 4 -> 5 thing i just can't find how to sort it.

cheers
Sorry i found my problem. What i needed to do was define my other arrays as arrays

i.e.
$m =array();$mE =array();

if ($mainAccounts)
{
$m = (get_start_dates($mainAccounts));
$mE = (get_end_dates($mainAccounts));
}

$startDatesArray = array_merge($m, $c, $r, $gr, $cr);

then it works fine.

Definately a php5 thing though as it works fine the other way on my box.
That seems to indicate the arrays are never being filled. I'd suggest you check, perhaps they are not being filled due to some other reason - but if
$m = (get_start_dates($mainAccounts));

should return an array, and you have to explicitly define $m as an array, that tells me that $m is not ever being filled.

Good luck anyway.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.