1
I would like to use decimal numbers, I will insert a decimal number into the input and I would like the class to pick when it is inserted, for example:
"min" => 0.00, "max" => 0.010
how can I do this?
<?php
$opcoes = array(
"graphic-red" => array(
"min" => 0,
"max" => 200
),
"graphic-blue" => array(
"min" => 200,
"max" => 500
),
"graphic-green" => array(
"min" => 500,
"max" => 800
),
);
$val= "";
$float = floatval($val);
echo $float; // 122.34343
$rock_factor = get_post_meta(get_the_ID(), "rock_factor", true);
$graphic = getCssClassFromValue($rock_factor, $opcoes);
function getCssClassFromValue($v, $op) {
foreach ($op as $ch => $val) {
if( $v > $val["min"] &&
$v < $val["max"] )
{
return $ch;
}
}
return "";
}
?>