Home > other >  implode(): Invalid arguments passed
implode(): Invalid arguments passed

Time:12-07

This is my Controller code

if($university == "")
{
    $university = "-";
}else if($university[0] == ""){
    $university = "-";
}else if(isset($university[0])){
    $university = implode(",",$university);
}else{
    $university = $university;
}

How to pass argument in implode() ?

CodePudding user response:

You passed implode argument is ok but your second argument is not an array.

if($university == "")
{
    $university = "-";
}else if($university[0] == ""){
    $university = "-";
}else if(isset($university[0])){ 
    $university = implode(",",$university); //<-- This argument is not an array
}else{
    $university = $university;
}
  • Related