/** * Evaluate the input variable and if the string can be converted to either * a boolean, float or integer converts it and return that value. * Otherwise simply return the inout variable unchanged. * * @param $value * @return bool|float|int|misc */ public static function correctType($value) { try { if (Str::isBoolean($value)) { $value = Str::toBoolean($value); } elseif (is_float($value)) { $value = floatval($value); } elseif (is_int($value)) { $value = intval($value); } } catch (Exception $ex) { } return $value; }