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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.