How can I achieve number 4,7,8 separately if there is a given variable: $i=478 such that I can store $j=4,$k=7,$l=8 in PHP. Is there a function?
Ultimately, I want to find the average of the digits in the input. In this case, I need to programmatically calculate 19 divided by 3.
$i = 478;
$stri = (string)$i;
$j = $stri[0];
$k = $stri[1];
$l = $stri[2];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With