CodeIgniter Forums
Undefined array key 1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Undefined array key 1 (/showthread.php?tid=80577)



Undefined array key 1 - Secux - 11-17-2021

SYSTEMPATH/View/Cell.php at line 167
PHP Code:
160             }
161 
162             $params 
= explode($separator, $params);
163             unset($separator);
164 
165             foreach 
($params as $p) {
166                 if (! empty($p)) {
167                     [$key, $val] = explode('=', $p); // ERROR LINE - Undefined array key 1 
168 
169                     $newParams
[trim($key)] = trim($val, ', ');
170                 }
171             }
172 
173             $params 
= $newParams;
174             unset($newParams); 

my code is:

PHP Code:
view_cell('\App\Libraries\get::getHtml''id='.$News['category']) 
$News['category'] is "42,57658,154,236"(this not work) or $News['category'] is "42" only(this work)

code in Libraries\get.php
PHP Code:
namespace App\Libraries;



class 
get
{

    public function 
getHtml($id)
    { 
   
        
$return explode(','$id);

        foreach (
$return as $row) {

           
$html[] = '<span class="badge rounded-pill bg-success">'.$row.'</div>';

        }

        return 
$html;
    }