• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to convert the int value to inch in PHP [closed]

php


PHP Snippet 1:

function cm2inches($cm)
{
     $inches = $cm/2.54;
     $inches = $inches%12;
     return sprintf('%d ins', $inches);
}
echo cm2inches(162);

PHP Snippet 2:

3 ins

Related Snippets

PHP function Not Working As Expected From functions.php Include File

Laravel Factory not calling callback 'afterCreating'

PHPUnit (Phar) Fatal Error Only When Test Fails

Find out the name of the last script that included the current one

Laravel: Why is my variable not being set while it's in the construct function of the controller?

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

PHPSpreadsheet - How Do I Use Auto Migration Tool

browsersync doesn't work with XAMPP

Need to display only array value in JSON output

PHP array_filter with arguments

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Confirm Leave on External Links in Wordpress

Phalcon: setStatusCode returns empty response

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

About Contact Privacy policy Terms and conditions