yii2

PHP separate string

若如初见. 提交于 2020-08-20 15:50:37
问题 I have a string that contains 128.82 . I want to split/separate them in 100 and 28.82 . var_dump(substr($kwh,0,3)); die(); It gives me 128 . How can I separate the 100 and 28.82 ? Any help would be highly appreciated Note: I am setting this because I have defined slabs. 1-100 , 101-150 , and so on. So I need to set them according to the slabs. The slabs may differ as it could be 1-50 , 51-100 , 100-150 , and so on. so I have to divide/split 128.82 like 50 for 1-50 , 50 for 51-100 and then 28