convert an array to an integer

0

you can convert every position of an array to an integer and save it in different variables. and how it would be done. I found that a string variable pdia become integer like this:

$VarInt= (int)$varString;

so try this way:

 for ($i=0; $i < $sizeArrAdv ; $i++) {


 $Yhire_date  [$i] = $this->ol_model->getyearHire($arrayAdvocates[$i]["roster_salesforcename"]);
 $Mhire_date [$i] = $this->ol_model->getmonthHire($arrayAdvocates[$i]["roster_salesforcename"]);


    $Yhire_daten[$i]= (int)$Yhire_date[$i];


                            }

but it does not work for me, I print it and it comes out (1) when the year is 2017.

$Yhire_date  [$i] = $this->ol_model->getyearHire($arrayAdvocates[$i]["roster_salesforcename"]);

This line goes to a method in the model which makes a query and only selects the year of a date using year ($ date) and returns it as an array, I want to convert that year into an int to be able to do operations with the

json object in array $ Yhire_date:

as you see the year it is always in the position [0] of the array

this gives me with:

 $Yhire_daten[$i]= idate('Y',$Yhire_date[$i][0]['year']);

    
asked by user80520 09.04.2018 в 23:59
source

0 answers