hi.. can someone temme how to truncate zero(0) after a decimal point.. eg: 50.0 , it should display 50
i need to implement this logic in php.. its urgent

    if $float is 50.0 then print (int)$float will print 50
    likewise $someint = (int)$float will truncate $float to an integer value

      If the issue is that you have a numeric string ending in one or more zeros, but you want to keep any non-zero decimal portion, just cast it to float:

      <?php
      $test = '12.300';
      echo $test;  // 12.300
      echo "<br>\n";
      echo (float)$test; // 12.3
      ?>
      
        Write a Reply...