I changed hosts and all of a sudden my implode code stopped working. It says "Warning: implode() [function.implode]: Invalid arguments passed in (webpage address here) on line 53". Please see my code below. if ('cp_features' == $metarow['meta_key'] && $metarow['meta_value']) $feature_items = implode(', ',$feature_array); if(!empty($feature_array)) { $features = "<li>Features: <font color=#21adf0>" . $feature_items . "</font></li>"; } Code (markup): I tried adding this code below and the error went away but then it messed up my feature list. $feature_array = array(); Code (markup):
Well, seems like that $feature_array is not an array or it doesn't exist. You can easily check if $feature_array is an array with the is_array() function. If it's not an array, check where it's initialized.
Well, if it doesn't exist, you have a problem. I don't know the whole code, but the array $feature_array is important. Without it, the code you provided is pretty much useless. So: Go into your code and search for the place where the array $feature_array is created. Probably reads from a database or something.
I've searched the code and the database and it's not there. Feature_items is in the database. Not sure how it's worked for the past few years on one host and now at the new host it doesn't.
Well, sadly, I cannot help you further. While changing hosts, something had to go missing (file deleted?). I really can't know.... Try to contact the guy that wrote the script (if it's well-known software, they have a forum or support), or add a database query, that creates the $feature_array and fills it with the right values.
Or didn't exist because your old host was still running PHP 3 instead of PHP 5. Why do I say PHP3? I see some telltales of it being that old, in which case it's probably bug-ridden insecure filth that needs a complete rewrite. The mere presence of a FONT tag screams that, but I see other bits of logic disconnects that raise questions... Like no closing bracket, so only the implode is run by that first condition? As GMF said I suspect we'd need to see more than a little snippet. Snippets are cute, but really end up like trying to do brain-surgury over a time-phone to 1887. I SUSPECT the logic should be something more like this: if ('cp_features' == $metarow['meta_key'] && $metarow['meta_value'] && isset($feature_array) && is_array($feature_array) && !empty($feature_array) ) { $features = ' <li> Features: <span>'.implode(', ',$feature_array).'</span> </li>'; } Code (markup): Though I'm guessing WILDLY as I have no clue as to the contents of any of those values, or where that IF statement is in the middle of everything or even when/where the code around it is opened/closed.
Thanks to everyone for your help. I put a "@" in front of the function so it hides the warning message since everything appears to be working correctly. It's a temporary fix until I can get someone to look at it closer. Thanks.