Friday 31 August 2012

convert min into hours using php


for converting the min into Hours you can use the following PHP function.

step for using PHP function :
1) call the function min2hours with parameter total min
2) and print the return value.


function min2hours($mins) { 

            if ($mins < 0) { 
                $min = Abs($mins); 
            } else { 
                $min = $mins; 
            } 

            $H = Floor($min / 60); 
            $M = ($min - ($H * 60)) / 100; 
            $hours = $H +  $M; 

            if ($mins < 0) { 
                $hours = $hours * (-1); 
            } 

            $expl = explode(".", $hours); 
            $H = $expl[0]; 

            if (empty($expl[1])) { 
                $expl[1] = 00; 
            } 

            $M = $expl[1]; 
            if (strlen($M) < 2) { 
                $M = $M . 0; 
            } 

            $hours = $H . ":" . $M; 
            return $hours; 
    } 

OUTPUT :

<?php echo min2hour(120); ?>

-- 2:00

Thursday 23 August 2012

Welcome to PHP-GHOST

Welcome to the PHP-GHOST...!!!!

In php ghost you can find the script and coding related to php.