Return the last 2 digits a number

后端 未结 6 989
Happy的楠姐
Happy的楠姐 2021-01-11 15:00

How can I get the last 2 digits of:

200912

to my object:

$year = $flightDates-&         


        
6条回答
  •  执笔经年
    2021-01-11 15:22

    You could use a basic aritimethic operation, like this...

    while ( $var > 100 ) 
    {
        $var = (int) $var / 10;
    }
    

    There could be a better solution but this one will fit fine

提交回复
热议问题