title: Trying to access array offset on value of type bool on codeigniter
body: <p>I am trying to go to the admin panel of my codeigniter project but. I am facing an error. which is <strong>Trying to access array offset on value of type bool</strong></p>
  <p>on view file --</p>
  <pre><code>&lt;?php 
  $report_list = get_ci_value(&quot;reports_list&quot;);
  if( count((array)$report_list) == 1){
      foreach ((array)$report_list as $row){
              $id = strtolower( str_replace(&quot; &quot;, &quot;_&quot;, $row['name']) );//the error is showing on this line
          if(!segment(3) == $id){
              redirect( get_module_url(&quot;index/&quot;.$id) );
          }
      }
  }
  ?&gt;
  </code></pre>
  <p>controller--</p>
  <pre><code>foreach ($tab_groups as $tab =&gt; $data) {
  
              foreach ($data as $main =&gt; $row) {
                  
                  if( isset( $row['sub_menu'] ) ){
                      usort( $row['sub_menu'] , function($a, $b) {
                          return $a['position'] &lt;=&gt; $b['position'];
                      });
  
                      $menu_groups[$tab][$main] = $row;             
                  }else{
                      $menu_groups[$tab][$main] = $row;
                  }
  
              }
  
          }
  
          if(isset($menu_groups[2])){
              $CI-&gt;reports_list = $menu_groups[2];
          }else{
              $CI-&gt;reports_list = false;
          }
  </code></pre>
  <p>I already tried this but it's not working. then another error comes- <strong>Undefined variable: id</strong></p>
  <pre><code>if( is_array($row) ) {
      $id = strtolower( str_replace(&quot; &quot;, &quot;_&quot;, $row['name']) );
  }
  </code></pre>
  <p>How can I solve this problem <strong>Trying to access array offset on value of type bool</strong> ? I am using <strong>php 7.4.11</strong></p>