Jump to content

get number in ones column


jwk811

Recommended Posts

If, by "ones column" you mean the digit immediately preceding the decimal point

 

<?php
  $numbers = array(2022399.983 , 3 , 0.00032);               // NB remove commas from numbers
  
  foreach ($numbers as $n) {
    echo $n, ' --> ', floor($n)%10, '<br>';   
  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.