Ejemplo n.º 1
0
 /**
  * TypeCast a string to its specific types.
  *
  * Arrays will passed to to the {{luya\helpers\ArrayHelper::typeCast}} class.
  *
  * @param mixed $string The input string to type cast. Arrays will be passted to {{luya\helpers\ArrayHelper::typeCast}}.
  * @return mixed The new type casted value, if the input is an array the output is the typecasted array.
  */
 public static function typeCast($string)
 {
     if (is_numeric($string)) {
         if (is_float($string)) {
             return (double) $string;
         } else {
             return (int) $string;
         }
     } elseif (is_array($string)) {
         return ArrayHelper::typeCast($string);
     }
     return $string;
 }