Divide integer number into 3 parts using php -


i need divide integer value 3 parts using php

for eg: have value 9 answer 3 + 3 + 3 if have value 10 ans 3 + 3 + 4 or that

you can use modulus function.

<?php     $yourint=10;     $remainder=$yourint % 3;     $third=floor($yourint/3);     $lastbit=$third+$remainder;      echo "the numbers $third + $third + $lastbit."; ?> 

output:

the numbers 3 + 3 + 4. 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -