c_shelswell Posted January 17, 2007 Share Posted January 17, 2007 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 Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 17, 2007 Share Posted January 17, 2007 The manual says nothing about a difference in 4-5. What are the variables? The error says $gr is not an array. Can you run print_r($gr); before this and see what it puts out? Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted January 17, 2007 Author Share Posted January 17, 2007 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. Quote Link to comment Share on other sites More sharing options...
printf Posted January 17, 2007 Share Posted January 17, 2007 Just CAST them, but the error is telling you, one of the parameter is not an array[code]$startDatesArray = array_merge ( ( array ) $m, ( array ) $c, ( array ) $r, ( array ) $gr, ( array ) $cr );[/code]printf Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 17, 2007 Share Posted January 17, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.