CodeIgniter Forums
how to convert array value to int - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: how to convert array value to int (/showthread.php?tid=77207)



how to convert array value to int - richb201 - 08-02-2020

I need to fill out the array below in order to get this library working. The two values that are in question are "value" and "baseValue". When I hard code the number 3 and the number 5 into these two it works fine. But my code below doesn't work. I tried casting both values to (int) but that didn't work either.


\koolreport\amazing\ProgressCard::create(array(
       
"title"=>"Percent Complete",
       
"infoText"=>"Three Way Risk Analysis",
       
"value"=>$this->dataStores['global_summary']['rows'][0]['num_titles_complete'],  //completed rows
        "preset"=>"primary",
       
"baseValue"=>$this->dataStores['global_summary']['rows'][0]['num_titles'],  //number of rows
        "format"=>array(
           
"value"=>array(
               
"prefix"=>"complete"
            ),
           
"indicator"=>array(
               
"decimals"=>2
            )
        ),
       
"cssClass"=>array(
           
"icon"=>"fa fa-euro"
        ),
    ));



RE: how to convert array value to int - richb201 - 08-03-2020

Solved. The proper way to get the value is

"value"=>$this->dataStore("global_summary")->get(0,"num_titles"),


RE: how to convert array value to int - InsiteFX - 08-03-2020

You can also cast the value (int) $somevalue