implode(): Argument #1 ($pieces) must be of type array, string given in implode()

implode(): Argument #1 ($pieces) must be of type array, string given in implode()



 

Proposed resolution

Change from this:


$variables['classes'] = implode(' ', $variables['classes_array']);


to this:
if(is_array($variables['classes_array']))
{
$variables['classes'] = implode(' ', $variables['classes_array']);
}
else if (is_string($variables['classes_array']))
{
$variables['classes'] = implode(' ', (array)$variables['classes_array']);
}


Maybe there is a better way to do this.

implode(): Argument #1 ($pieces) must be of type array, string given in implode() implode(): Argument #1 ($pieces) must be of type array, string given in implode() Reviewed by TechTubeHQ on January 02, 2023 Rating: 5

No comments:

Powered by Blogger.