Oct
22
Posted on 22-10-2007
Filed Under (Sample Code) by joseph
<?php${'New variable text'} = 'This is a new variable text.';

echo ${'New variable text'};

// This is a new variable text.

?>
Php Hace Script
function hace($timestamp)

{

$diferencia = time() - $timestamp;

 if($diferencia > 0)

 {

$periodo = array("segundo", "minuto", "hora", "dia", "semana", "mes" , "año", "decada");

$longitud = array(           "60"    , "60"  , "24" , "7"     , "4.35", "12"       , "10"    );	for($j = 0; $diferencia >= $longitud[$j]; $j++)

 $diferencia /= $longitud[$j];

$diferencia = round($diferencia);

if($diferencia != 1)

 {

 	if($periodo[$j] == "mes")

 	$periodo[$j].= "es";

 	else

 	$periodo[$j].= "s";

 }

return "Hace <b>".$diferencia."</b> ".$periodo[$j];

 }

}
(0) Comments    Read More